mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 11:26:50 +08:00
Merge branch 'preview' of codeup.aliyun.com:6265f483e4166464dc2f9c14/boeu/baseservers into release
This commit is contained in:
@@ -32,6 +32,13 @@
|
||||
<artifactId>xboe-module-course</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-module-event</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-module-idconfig</artifactId>
|
||||
|
||||
@@ -229,7 +229,7 @@ public class Cases extends BaseEntity {
|
||||
|
||||
public Cases() {
|
||||
}
|
||||
public Cases(String id,String title,String summary,String coverUrl,String authorId,String authorName,LocalDateTime sysCreateTime,Integer breCommend){
|
||||
public Cases(String id,String title,String summary,String coverUrl,String authorId,String authorName,LocalDateTime sysCreateTime,Integer breCommend,Integer views,Integer comments,Integer praises,Integer shares,Integer favorites){
|
||||
this.title=title;
|
||||
super.setId(id);
|
||||
this.authorId=authorId;
|
||||
@@ -238,6 +238,11 @@ public class Cases extends BaseEntity {
|
||||
this.summary=summary;
|
||||
this.coverUrl=coverUrl;
|
||||
this.breCommend=breCommend;
|
||||
this.views=views;
|
||||
this.comments=comments;
|
||||
this.praises=praises;
|
||||
this.shares=shares;
|
||||
this.favorites=favorites;
|
||||
}
|
||||
|
||||
public Cases(String id,String title){
|
||||
|
||||
@@ -324,7 +324,7 @@ public class Course extends BaseEntity {
|
||||
@Transient
|
||||
private Integer auditForward;
|
||||
|
||||
public Course(String id,String name,String summary,String coverImg,String sysCreateAid,String sysCreateBy,Integer type,LocalDateTime publishTime){
|
||||
public Course(String id,String name,String summary,String coverImg,String sysCreateAid,String sysCreateBy,Integer type,LocalDateTime publishTime,Integer views,Integer comments,Integer praises,Integer shares,Integer favorites){
|
||||
super.setId(id);
|
||||
this.name=name;
|
||||
this.summary=summary;
|
||||
@@ -333,6 +333,11 @@ public class Course extends BaseEntity {
|
||||
super.setSysCreateBy(sysCreateBy);
|
||||
this.type=type;
|
||||
this.publishTime=publishTime;
|
||||
this.views=views;
|
||||
this.comments=comments;
|
||||
this.praises=praises;
|
||||
this.shares=shares;
|
||||
this.favorites=favorites;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -20,6 +19,8 @@ import com.xboe.account.service.IAccountService;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.utils.IDGenerator;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.event.IEventDataSender;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.core.orm.LikeMatchMode;
|
||||
@@ -48,7 +49,6 @@ import com.xboe.module.course.service.CourseToCourseFullText;
|
||||
import com.xboe.module.course.service.ICourseFullTextSearch;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.interaction.service.ICourseGradeService;
|
||||
import com.xboe.stat.IEventDataSender;
|
||||
import com.xboe.system.authority.service.IResDataManagerService;
|
||||
import com.xboe.system.logs.dao.SysLogAuditDao;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
@Autowired(required = false)
|
||||
private ICourseFullTextSearch fullTextSearch;
|
||||
|
||||
@Autowired
|
||||
@Autowired(required = false)
|
||||
private IEventDataSender eventSender;
|
||||
|
||||
/**
|
||||
@@ -370,7 +370,11 @@ public class CourseServiceImpl implements ICourseService {
|
||||
courseDao.updateFieldById(id,"name","已删除"+name);
|
||||
//同时添加发布事件,这里的创建人需要修改为教师
|
||||
Course c=courseDao.get(id);
|
||||
eventSender.send("删除课程","PublishCourse", "删除课程【"+c.getName()+"】", c.getId(), "1", c.getName(), c.getSysCreateAid(), c.getSysCreateBy(),"");
|
||||
if(eventSender!=null) {
|
||||
eventSender.send("删除课程","PublishCourse", "删除课程【"+c.getName()+"】", c.getId(), "1", c.getName(), c.getSysCreateAid(), c.getSysCreateBy(),"");
|
||||
}else {
|
||||
log.error("未配置事件消息发送的实现");
|
||||
}
|
||||
//删除
|
||||
if(c.getFullTextId()!=null) {
|
||||
try {
|
||||
@@ -733,8 +737,11 @@ public class CourseServiceImpl implements ICourseService {
|
||||
this.fullTextPublish(c);
|
||||
}
|
||||
//同时添加发布事件,这里的创建人需要修改为教师
|
||||
eventSender.send("发布课程","PublishCourse", "发布课程【"+c.getName()+"】", c.getId(), "1", c.getName(), c.getSysCreateAid(), c.getSysCreateBy(),"");
|
||||
|
||||
if(eventSender!=null) {
|
||||
eventSender.send("发布课程","PublishCourse", "发布课程【"+c.getName()+"】", c.getId(), "1", c.getName(), c.getSysCreateAid(), c.getSysCreateBy(),"");
|
||||
}else {
|
||||
log.error("未配置事件消息发送的实现");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,11 @@ import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.module.interaction.dto.*;
|
||||
import com.xboe.module.qa.entity.Question;
|
||||
import com.xboe.module.qa.service.IQuestionService;
|
||||
import com.xboe.school.study.service.IStudyCourseService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -43,6 +46,9 @@ public class FavoritesApi extends ApiBaseController {
|
||||
@Autowired
|
||||
IStudyCourseService studyCourseService;
|
||||
|
||||
@Autowired
|
||||
IQuestionService questionService;
|
||||
|
||||
/**
|
||||
* 此处的查询需要再讨论一下,因为有不同的内容,前端呈现的也不一样
|
||||
*
|
||||
@@ -104,6 +110,26 @@ public class FavoritesApi extends ApiBaseController {
|
||||
return success(articlePage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我收藏的问答
|
||||
* */
|
||||
@PostMapping("/favorite-answer")
|
||||
public JsonResponse<PageList<FavoritesAnswerDto>> findAnswerPage(Pagination pager,String keyword,Boolean isBest){
|
||||
String aid = this.getCurrent().getAccountId();
|
||||
PageList<FavoritesAnswerDto> answerPage = service.findAnswerPage(pager.getPageIndex(), pager.getPageSize(), keyword, isBest, aid);
|
||||
List<String> qids = answerPage.getList().stream().map(FavoritesAnswerDto::getQid).collect(Collectors.toList());
|
||||
//查出问题标题
|
||||
List<Question> questions = questionService.title(qids);
|
||||
for (FavoritesAnswerDto f:answerPage.getList()) {
|
||||
for (Question q:questions) {
|
||||
if(f.getQid().equals(q.getId())){
|
||||
f.setQtitle(q.getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
return success(answerPage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -222,6 +248,7 @@ public class FavoritesApi extends ApiBaseController {
|
||||
public JsonResponse<PageList<FavoriteTotalDto>> queryAll(Pagination pager,String keyword){
|
||||
String aid = this.getCurrent().getAccountId();
|
||||
PageList<FavoriteTotalDto> favoriteTotalDtoPageList = service.queryAll(pager.getPageIndex(), pager.getPageSize(), aid, keyword);
|
||||
|
||||
List<String> courseIds = favoriteTotalDtoPageList.getList().stream().filter(favoriteTotalDto -> favoriteTotalDto.getType() == 1).
|
||||
map(FavoriteTotalDto::getId).collect(Collectors.toList());
|
||||
List<Object[]> progress = studyCourseService.progress(aid, courseIds);
|
||||
@@ -235,6 +262,24 @@ public class FavoritesApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
List<String> qids = favoriteTotalDtoPageList.getList().stream().filter(favoriteTotalDto -> favoriteTotalDto.getType() == 5).
|
||||
map(FavoriteTotalDto::getQid).collect(Collectors.toList());
|
||||
|
||||
List<Question> questions = questionService.title(qids);
|
||||
if(!questions.isEmpty()) {
|
||||
for (FavoriteTotalDto f : favoriteTotalDtoPageList.getList()) {
|
||||
if(StringUtils.isNotBlank(f.getQid())) {
|
||||
for (Question q : questions) {
|
||||
if(StringUtil.isNotBlank(q.getId())) {
|
||||
if (f.getQid().equals(q.getId())) {
|
||||
f.setTitle(q.getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return success(favoriteTotalDtoPageList);
|
||||
}
|
||||
|
||||
@@ -86,6 +86,11 @@ public class FavoriteTotalDto {
|
||||
* */
|
||||
private Float progress;
|
||||
|
||||
/**
|
||||
* qid
|
||||
* */
|
||||
private String qid;
|
||||
|
||||
|
||||
public FavoriteTotalDto() {
|
||||
}
|
||||
@@ -94,4 +99,6 @@ public class FavoriteTotalDto {
|
||||
this.favoritesTime=favoritesTime;
|
||||
this.type=type;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.xboe.module.interaction.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class FavoritesAnswerDto {
|
||||
|
||||
/**
|
||||
* 问题标题
|
||||
* */
|
||||
|
||||
private String qtitle;
|
||||
|
||||
/**
|
||||
* 问题id
|
||||
* */
|
||||
|
||||
private String qid;
|
||||
|
||||
/**
|
||||
* 答案内容
|
||||
* */
|
||||
|
||||
private String content;
|
||||
|
||||
|
||||
private Integer praises;
|
||||
|
||||
|
||||
private Integer shares;
|
||||
|
||||
|
||||
private Integer favorites;
|
||||
|
||||
|
||||
/**
|
||||
* 收藏时间
|
||||
* */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime favoeiteTime;
|
||||
|
||||
|
||||
/**
|
||||
* 收藏id
|
||||
* */
|
||||
|
||||
private String favoriteId;
|
||||
|
||||
/**
|
||||
* 收藏人id
|
||||
* */
|
||||
private String favorSysCreateId;
|
||||
|
||||
/**
|
||||
* 答案作者id
|
||||
* */
|
||||
private String sysCreateAid;
|
||||
|
||||
/**
|
||||
* 答案作者id
|
||||
* */
|
||||
private String sysCreateBy;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
* */
|
||||
private String images;
|
||||
|
||||
private Integer objType;
|
||||
|
||||
/**
|
||||
* 答案id
|
||||
* */
|
||||
private String answerId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public interface IFavoritesService {
|
||||
PageList<FavoriteDto> findCoursePage(int pageIndex, int pageSize, Favorites favorite,Integer type,String keyword,String aid);
|
||||
|
||||
/**
|
||||
* 查询收藏的问答
|
||||
* 查询收藏的问题
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @param favorite
|
||||
@@ -33,6 +33,13 @@ public interface IFavoritesService {
|
||||
* @return
|
||||
*/
|
||||
PageList<FavoriteQaDto> findQaPage(int pageIndex, int pageSize, Favorites favorite,Boolean isResolve,String keyword,String aid);
|
||||
|
||||
|
||||
/**
|
||||
* 查询收藏的回答
|
||||
* */
|
||||
PageList<FavoritesAnswerDto> findAnswerPage(int pageIndex,int pageSize,String keyWord,Boolean isBest,String aid);
|
||||
|
||||
/**
|
||||
* 查询收藏的案例
|
||||
// * */
|
||||
|
||||
@@ -12,6 +12,9 @@ import java.util.Set;
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.xboe.module.interaction.dto.*;
|
||||
import com.xboe.module.qa.dao.AnswerDao;
|
||||
import com.xboe.module.qa.entity.Answer;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -33,11 +36,6 @@ import com.xboe.module.boecase.entity.Cases;
|
||||
import com.xboe.module.course.dao.CourseDao;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.interaction.dao.FavoritesDao;
|
||||
import com.xboe.module.interaction.dto.FavoriteArticleDto;
|
||||
import com.xboe.module.interaction.dto.FavoriteCaseDto;
|
||||
import com.xboe.module.interaction.dto.FavoriteDto;
|
||||
import com.xboe.module.interaction.dto.FavoriteQaDto;
|
||||
import com.xboe.module.interaction.dto.FavoriteTotalDto;
|
||||
import com.xboe.module.interaction.entity.Favorites;
|
||||
import com.xboe.module.interaction.service.IFavoritesService;
|
||||
import com.xboe.module.qa.dao.QuestionDao;
|
||||
@@ -70,6 +68,9 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
@Resource
|
||||
CasesDao casesDao;
|
||||
|
||||
@Autowired
|
||||
AnswerDao answerDao;
|
||||
|
||||
|
||||
@Override
|
||||
@Caching(evict = {@CacheEvict(value = CacheName.FAVOR, key = "'" + CacheName.KEY_FAVOR + "'+#favorite.objType+#favorite.objId+#favorite.sysCreateAid")})
|
||||
@@ -137,9 +138,12 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
//案例id集合
|
||||
Set<String> caseList = new HashSet<>();
|
||||
// Map<String,FavoriteTotalDto> map = new HashMap<>();
|
||||
|
||||
//笔记id集合
|
||||
Set<String> noteList = new HashSet<>();
|
||||
|
||||
//回答id集合
|
||||
Set<String> answerList = new HashSet<>();
|
||||
|
||||
for (Favorites f: page.getList()) {
|
||||
FavoriteTotalDto favoriteTotalDto = new FavoriteTotalDto();
|
||||
favoriteTotalDto.setFavoritesTime(f.getSysCreateTime());
|
||||
@@ -164,6 +168,9 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
if(f.getObjType()==6){
|
||||
noteList.add(f.getObjId());
|
||||
}
|
||||
if(f.getObjType()==5){
|
||||
answerList.add(f.getObjId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -177,7 +184,7 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
if(!courseList.isEmpty()) {
|
||||
QueryBuilder from = QueryBuilder.from(Course.class);
|
||||
from.addFilter(FieldFilters.in("id",courseList));
|
||||
from.addFields("new Course(id,name,summary,coverImg,sysCreateAid,sysCreateBy,type,publishTime)");
|
||||
from.addFields("new Course(id,name,summary,coverImg,sysCreateAid,sysCreateBy,type,publishTime,views,comments,praises,shares,favorites)");
|
||||
List<Course> courses = courseDao.findList(from.builder());
|
||||
if(!courses.isEmpty()){
|
||||
for (Course c : courses) {
|
||||
@@ -191,6 +198,11 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
favoriteTotalDto.setAuthorName(c.getSysCreateBy());
|
||||
favoriteTotalDto.setContentType(c.getType());
|
||||
favoriteTotalDto.setPublishTime(c.getPublishTime());
|
||||
favoriteTotalDto.setViews(c.getViews());
|
||||
favoriteTotalDto.setComments(c.getComments());
|
||||
favoriteTotalDto.setPraises(c.getPraises());
|
||||
favoriteTotalDto.setShares(c.getShares());
|
||||
favoriteTotalDto.setFavorites(c.getFavorites());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,6 +224,12 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
favoriteTotalDto.setAuthorId(a.getSysCreateAid());
|
||||
favoriteTotalDto.setAuthorName(a.getSysCreateBy());
|
||||
favoriteTotalDto.setPublishTime(a.getSysCreateTime());
|
||||
favoriteTotalDto.setViews(a.getViews());
|
||||
favoriteTotalDto.setComments(a.getComments());
|
||||
favoriteTotalDto.setPraises(a.getPraises());
|
||||
favoriteTotalDto.setShares(a.getShares());
|
||||
favoriteTotalDto.setFavorites(a.getFavorites());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,7 +238,7 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
if(!qaList.isEmpty()) {
|
||||
QueryBuilder from = QueryBuilder.from(Question.class);
|
||||
from.addFilter(FieldFilters.in("id",qaList));
|
||||
from.addFields("new Question(id,title,content,images,sysCreateAid,sysCreateBy,sysCreateTime,bestId,bestAnswer,isResolve)");
|
||||
from.addFields("new Question(id,title,content,images,sysCreateAid,sysCreateBy,sysCreateTime,bestId,bestAnswer,isResolve,views,answers,praises,shares,favorites)");
|
||||
List<Question> questions = questionDao.findList(from.builder());
|
||||
if(!questions.isEmpty()) {
|
||||
for (Question q : questions) {
|
||||
@@ -235,6 +253,11 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
favoriteTotalDto.setBestId(q.getBestId());
|
||||
favoriteTotalDto.setBestAnswer(q.getBestAnswer());
|
||||
favoriteTotalDto.setIsResolve(q.getIsResolve());
|
||||
favoriteTotalDto.setViews(q.getViews());
|
||||
favoriteTotalDto.setComments(q.getAnswers());
|
||||
favoriteTotalDto.setPraises(q.getPraises());
|
||||
favoriteTotalDto.setShares(q.getShares());
|
||||
favoriteTotalDto.setFavorites(q.getFavorites());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,7 +266,7 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
if(!caseList.isEmpty()) {
|
||||
QueryBuilder from = QueryBuilder.from(Cases.class);
|
||||
from.addFilter(FieldFilters.in("id", caseList));
|
||||
from.addFields("new Cases(id,title,summary,coverUrl,authorId,authorName,sysCreateTime,breCommend)");
|
||||
from.addFields("new Cases(id,title,summary,coverUrl,authorId,authorName,sysCreateTime,breCommend,views,comments,praises,shares,favorites)");
|
||||
List<Cases> cases = courseDao.findList(from.builder());
|
||||
if(!cases.isEmpty()) {
|
||||
for (Cases c : cases) {
|
||||
@@ -256,6 +279,11 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
favoriteTotalDto.setAuthorName(c.getAuthorName());
|
||||
favoriteTotalDto.setPublishTime(c.getSysCreateTime());
|
||||
favoriteTotalDto.setBreCommend(c.getBreCommend());
|
||||
favoriteTotalDto.setViews(c.getViews());
|
||||
favoriteTotalDto.setComments(c.getComments());
|
||||
favoriteTotalDto.setPraises(c.getPraises());
|
||||
favoriteTotalDto.setShares(c.getShares());
|
||||
favoriteTotalDto.setFavorites(c.getFavorites());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,7 +299,7 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
ids.append(",");
|
||||
}
|
||||
ids.deleteCharAt(ids.length()-1);
|
||||
String sql="select id,course_name,content,sys_create_aid,sys_create_by,sys_create_time from boe_note_info where id in("+ids+")";
|
||||
String sql="select id,course_name,content,sys_create_aid,sys_create_by,sys_create_time,praises,favorites,comments from boe_note_info where id in("+ids+")";
|
||||
List<Object[]> list1 = dao.sqlFindList(sql);
|
||||
for (Object[] o:list1){
|
||||
for (FavoriteTotalDto favoriteTotalDto : list.getList()) {
|
||||
@@ -280,14 +308,49 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
favoriteTotalDto.setContent((String) o[2]);
|
||||
favoriteTotalDto.setAuthorId((String) o[3]);
|
||||
favoriteTotalDto.setAuthorName((String) o[4]);
|
||||
|
||||
Timestamp time = (Timestamp)o[5];
|
||||
|
||||
favoriteTotalDto.setPublishTime(time.toLocalDateTime());
|
||||
favoriteTotalDto.setPraises((Integer)o[6]);
|
||||
favoriteTotalDto.setFavorites((Integer) o[7]);
|
||||
favoriteTotalDto.setComments((Integer) o[8]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!answerList.isEmpty()){
|
||||
QueryBuilder from = QueryBuilder.from(Answer.class);
|
||||
from.addFilter(FieldFilters.in("id", answerList));
|
||||
|
||||
|
||||
from.addFields("id","content","images","praises","shares","favorites","sysCreateAid","sysCreateBy","qid","sysCreateTime");
|
||||
try {
|
||||
List<Object[]> listFields = articleDao.findListFields(from.builder());
|
||||
for (Object[] o:listFields) {
|
||||
for (FavoriteTotalDto favoriteTotalDto : list.getList()) {
|
||||
if(o[0].equals(favoriteTotalDto.getId())) {
|
||||
favoriteTotalDto.setContent((String) o[1]);
|
||||
favoriteTotalDto.setImage((String) o[2]);
|
||||
favoriteTotalDto.setPraises((Integer) o[3]);
|
||||
favoriteTotalDto.setShares((Integer) o[4]);
|
||||
favoriteTotalDto.setFavorites((Integer) o[5]);
|
||||
favoriteTotalDto.setAuthorId((String) o[6]);
|
||||
favoriteTotalDto.setAuthorName((String) o[7]);
|
||||
|
||||
favoriteTotalDto.setQid((String) o[8]);
|
||||
|
||||
favoriteTotalDto.setPublishTime((LocalDateTime) o[9]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
list.setCount(page.getCount());
|
||||
list.setPageSize(pageSize);
|
||||
return list;
|
||||
@@ -501,6 +564,53 @@ public class FavoritesServiceImpl implements IFavoritesService{
|
||||
// return result;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<FavoritesAnswerDto> findAnswerPage(int pageIndex, int pageSize, String keyWord, Boolean isBest, String aid) {
|
||||
PageList<FavoritesAnswerDto> pageList = new PageList<>();
|
||||
pageList.setList(new ArrayList<FavoritesAnswerDto>());
|
||||
pageList.setPageSize(pageSize);
|
||||
String from =Favorites.class.getSimpleName()+" f,"+ Answer.class.getSimpleName()+" a";
|
||||
QueryBuilder builder=QueryBuilder.from(from);
|
||||
builder.setPageIndex(pageIndex);
|
||||
builder.setPageSize(pageSize);
|
||||
builder.addOrder(OrderCondition.desc("f.id"));
|
||||
builder.addFilter(FieldFilters.eqField("f.objId","a.id"));
|
||||
builder.addFilter(FieldFilters.eq("f.objType",BoedxResourceType.Answer.value()));
|
||||
builder.addFilter(FieldFilters.eq("f.sysCreateAid",aid));
|
||||
if(StringUtils.isNotBlank(keyWord)){
|
||||
builder.addFilter(FieldFilters.like("a.content",keyWord));
|
||||
}
|
||||
builder.addFields("f.id","f.sysCreateTime","f.sysCreateAid,f.objType","a.id","a.content","a.praises","a.shares","a.favorites","a.sysCreateAid","a.qid","a.sysCreateBy","a.images");
|
||||
PageList<Object[]> pageFields=null;
|
||||
try {
|
||||
pageFields=dao.findPageFields(builder.builder());
|
||||
pageList.setPageSize(pageSize);
|
||||
pageList.setCount(pageFields.getCount());
|
||||
for (Object[] o:pageFields.getList()) {
|
||||
FavoritesAnswerDto favoritesAnswerDto = new FavoritesAnswerDto();
|
||||
favoritesAnswerDto.setFavoriteId((String) o[0]);
|
||||
favoritesAnswerDto.setFavoeiteTime((LocalDateTime) o[1]);
|
||||
favoritesAnswerDto.setFavorSysCreateId((String) o[2]);
|
||||
favoritesAnswerDto.setObjType((Integer) o[3]);
|
||||
favoritesAnswerDto.setAnswerId((String) o[4]);
|
||||
favoritesAnswerDto.setContent((String) o[5]);
|
||||
favoritesAnswerDto.setPraises((Integer) o[6]);
|
||||
favoritesAnswerDto.setShares((Integer) o[7]);
|
||||
favoritesAnswerDto.setFavorites((Integer) o[8]);
|
||||
favoritesAnswerDto.setSysCreateAid((String) o[9]);
|
||||
favoritesAnswerDto.setQid((String) o[10]);
|
||||
favoritesAnswerDto.setSysCreateBy((String) o[11]);
|
||||
favoritesAnswerDto.setImages((String) o[12]);
|
||||
pageList.getList().add(favoritesAnswerDto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("收藏回答关联错误",e);
|
||||
}
|
||||
return pageList;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我收藏的案例
|
||||
* */
|
||||
|
||||
@@ -128,7 +128,7 @@ public class Question extends BaseEntity {
|
||||
this.answers=answers;
|
||||
}
|
||||
|
||||
public Question(String id,String title, String content, String images,String sysCreateAid,String sysCreateBy,LocalDateTime sysCreateTime, String bestId, String bestAnswer,Boolean isResolve) {
|
||||
public Question(String id,String title, String content, String images,String sysCreateAid,String sysCreateBy,LocalDateTime sysCreateTime, String bestId, String bestAnswer,Boolean isResolve,Integer views,Integer answers,Integer praises,Integer shares,Integer favorites) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.images = images;
|
||||
@@ -139,6 +139,11 @@ public class Question extends BaseEntity {
|
||||
super.setSysCreateAid(sysCreateAid);
|
||||
super.setSysCreateBy(sysCreateBy);
|
||||
super.setSysCreateTime(sysCreateTime);
|
||||
this.views=views;
|
||||
this.answers=answers;
|
||||
this.praises=praises;
|
||||
this.shares=shares;
|
||||
this.favorites=favorites;
|
||||
}
|
||||
|
||||
public Question(String id,String title){
|
||||
|
||||
@@ -97,5 +97,10 @@ public interface IQuestionService {
|
||||
* */
|
||||
List<Question> indexQaAnswers(Integer num);
|
||||
|
||||
/**
|
||||
* 查询该回答的问答标题
|
||||
* */
|
||||
List<Question> title(List<String> aid);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -482,5 +482,16 @@ public class QuestionServiceImpl implements IQuestionService {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Question> title(List<String> qid) {
|
||||
QueryBuilder builder = QueryBuilder.from(Question.class);
|
||||
builder.addFilter(FieldFilters.in("id",qid));
|
||||
builder.addFields("new Question(id,title)");
|
||||
List<Question> list = questionDao.findList(builder.builder());
|
||||
return list;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseSectionService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.service.ICourseTeacherService;
|
||||
import com.xboe.module.teacher.entity.Teacher;
|
||||
import com.xboe.module.teacher.service.ITeacherService;
|
||||
import com.xboe.school.study.dto.StudyContentDto;
|
||||
@@ -70,9 +69,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
@Autowired
|
||||
private ICourseSectionService sectionService;
|
||||
|
||||
@Autowired
|
||||
private ICourseTeacherService courseTeacherService;
|
||||
|
||||
@Autowired
|
||||
private ITeacherService teacherService;
|
||||
|
||||
@@ -136,26 +132,27 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/studyIndex",method = {RequestMethod.GET,RequestMethod.POST})
|
||||
public JsonResponse<Map<String,Object>> loadDetail(String id,Boolean addView,Boolean crowd){
|
||||
if(StringUtils.isBlank(id)){
|
||||
public JsonResponse<Map<String,Object>> loadDetail(String cid,Boolean addView,Boolean crowd){
|
||||
if(StringUtils.isBlank(cid)){
|
||||
return error("无课程信息");
|
||||
}
|
||||
String aid=getCurrent().getAccountId();
|
||||
CurrentUser cuser=getCurrent();
|
||||
String aid=cuser.getAccountId();
|
||||
//StudyCourse sc=service.findByCourseIdAndAid(id, aid);
|
||||
Map<String,Object> rs=new HashMap<String,Object>();
|
||||
Course course=courseService.getAddView(id);
|
||||
Course course=courseService.getAddView(cid);
|
||||
if(course==null || course.getDeleted()){
|
||||
return badRequest("课程不存在或已被删除");
|
||||
}
|
||||
rs.put("course",course);
|
||||
|
||||
List<CourseCrowd> courseCrowdList = courseService.findCrowdByCourseId(id);
|
||||
List<CourseCrowd> courseCrowdList = courseService.findCrowdByCourseId(cid);
|
||||
if(crowd!=null && crowd) {
|
||||
rs.put("crowds",courseCrowdList);
|
||||
}
|
||||
List<CourseContent> cclist=contentService.getByCourseId(id);
|
||||
List<CourseSection> sectionlist=sectionService.getByCourseId(id);
|
||||
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(id);
|
||||
List<CourseContent> cclist=contentService.getByCourseId(cid);
|
||||
List<CourseSection> sectionlist=sectionService.getByCourseId(cid);
|
||||
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(cid);
|
||||
|
||||
//获取教师的介绍信息,因为一门课程 的教师不会太多,所以这里简单直接遍历查询,后续再优化
|
||||
for(CourseTeacher ct : teachers) {
|
||||
@@ -172,13 +169,33 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
rs.put("teachers",teachers);
|
||||
|
||||
//检查是否已报名
|
||||
StudySignup ss = signupService.getByCidAndAid(id, aid);
|
||||
if(ss!=null && ss.getStatus()!=null && ss.getStatus()==9) {
|
||||
rs.put("signup",true);
|
||||
}else {
|
||||
rs.put("signup",false);
|
||||
StudyCourse sc=service.findByCourseIdAndAid(cid, aid);
|
||||
if(sc==null) {
|
||||
//未报名,这里直接报名
|
||||
StudySignup signup=new StudySignup();
|
||||
signup.setCourseId(cid);
|
||||
signup.setCourseName(course.getName());
|
||||
signup.setCourseType(course.getType());
|
||||
signup.setSignInfo("自主报名");
|
||||
signup.setAuditInfo("系统自动审核");
|
||||
signup.setAuditUser("");
|
||||
signup.setAuditType(1);
|
||||
signup.setSignTime(LocalDateTime.now());
|
||||
signup.setSignType(1);
|
||||
signup.setStatus(9);
|
||||
signup.setAid(cuser.getAccountId());
|
||||
signup.setName(cuser.getName());
|
||||
signup.setSignTime(LocalDateTime.now());
|
||||
sc=service.autoSignup(signup);
|
||||
}
|
||||
|
||||
rs.put("signup",true);
|
||||
rs.put("studyId", sc.getId());//学习id
|
||||
rs.put("progress", sc.getProgress());
|
||||
//查询上次学习的是什么资源。查询用户的学习情况
|
||||
List<StudyCourseItem> items=studyService.findByStudyId(sc.getId());
|
||||
rs.put("contentStudys",items);//学习的内容
|
||||
|
||||
return success(rs);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,20 @@ import com.xboe.school.study.dto.StudyCourseQuery;
|
||||
import com.xboe.school.study.dto.StudyCouseDto;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudySignup;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IStudyCourseService {
|
||||
|
||||
/**
|
||||
* 课程自动报名,返回学习的课程
|
||||
* @param signup
|
||||
* @return
|
||||
*/
|
||||
StudyCourse autoSignup(StudySignup signup);
|
||||
|
||||
/**
|
||||
* 检查是否有相应的课程学习记录
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.xboe.school.study.dto.StudyCourseNameDto;
|
||||
import com.xboe.school.study.dto.StudyCourseQuery;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudySignup;
|
||||
import com.xboe.school.study.service.IStudyCourseService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -47,6 +48,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Transactional
|
||||
public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
|
||||
@Autowired
|
||||
StudySignupDao signupDao;
|
||||
|
||||
@Autowired
|
||||
StudyCourseDao studyCourseDao;
|
||||
|
||||
@@ -512,4 +516,42 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StudyCourse autoSignup(StudySignup signup) {
|
||||
|
||||
signup.setSignType(StudySignup.SIGNTYPE_SELF);
|
||||
if(signup.getStatus()==null) {
|
||||
//如果未指定状态,就设置审核通过
|
||||
signup.setStatus(StudySignup.STATUS_PASS);
|
||||
signup.setAuditType(StudySignup.AUDITTYPE_AUTO);
|
||||
signup.setAuditInfo("系统自动审核");
|
||||
signup.setAuditUser("");
|
||||
}
|
||||
signupDao.save(signup);
|
||||
//添加到课程学习
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
|
||||
StudyCourse sc=new StudyCourse();
|
||||
sc.setAddTime(LocalDateTime.now());
|
||||
sc.setAid(signup.getAid());
|
||||
sc.setAname(signup.getName());
|
||||
sc.setCourseId(signup.getCourseId());
|
||||
sc.setCourseName(signup.getCourseName());
|
||||
sc.setCourseType(signup.getCourseType());//课程类型没有带过来
|
||||
sc.setFinishTime(null);
|
||||
sc.setLastScore(0f);
|
||||
sc.setProgress(0f);
|
||||
sc.setSource(signup.getAuditType());//来源方式,和报名类型一致
|
||||
sc.setStatus(StudyCourse.STATUS_NOSTUDY);
|
||||
sc.setStatusTime(now);
|
||||
sc.setTotalDuration(0);
|
||||
sc.setLastTime(sc.getAddTime());
|
||||
studyCourseDao.save(sc);
|
||||
signup.setStudyId(sc.getId());
|
||||
//更新课程学习人数
|
||||
courseDao.updateMultiFieldById(signup.getCourseId(),UpdateBuilder.create("studys", "studys+1",FieldUpdateType.EXPRESSION));
|
||||
|
||||
return sc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
package com.xboe.stat.impl;
|
||||
package com.xboe.stat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.api.TokenProxy;
|
||||
import com.xboe.core.event.IEventDataSender;
|
||||
import com.xboe.core.utils.OkHttpUtil;
|
||||
import com.xboe.standard.BaseConstant;
|
||||
import com.xboe.stat.IEventDataSender;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 事件数据发送者
|
||||
* 事件数据发送实现,如果是云环境,只需要修改此类的实现就可以了
|
||||
* @author seastar
|
||||
*
|
||||
*/
|
||||
@@ -35,8 +36,18 @@ public class EventDataSender implements IEventDataSender{
|
||||
@Override
|
||||
public void send(String title, String eventKey, String content, String objId, String objType, String objInfo,
|
||||
String aid, String aname,String author) {
|
||||
String statBaseUrl=SysConstant.getConfigValue("xboe.stat.base.url");
|
||||
if(StringUtils.isBlank(statBaseUrl)) {
|
||||
log.error("发送事件失败:未配置【xboe.stat.base.url】的值");
|
||||
return;
|
||||
}
|
||||
String urlPre="/xboe/m/stat/event/send";
|
||||
//案例同步不需要token
|
||||
if(eventKey.equals("SyncCase")) {
|
||||
urlPre ="/inner/stat/event/send";
|
||||
}
|
||||
|
||||
String url = SysConstant.getConfigValue("xboe.stat.base.url") + "/xboe/m/stat/event/send";
|
||||
final String url = statBaseUrl + urlPre;
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("title", title);
|
||||
params.put("source", "all");
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.xboe.stat;
|
||||
|
||||
public interface IEventDataSender {
|
||||
|
||||
|
||||
/**
|
||||
* 发送事件消息
|
||||
* @param title 事件标题
|
||||
* @param eventKey 事件key
|
||||
* @param content 事件内容
|
||||
* @param objId 关联对象id
|
||||
* @param objType 关联对象类型
|
||||
* @param objInfo 关联对象信息
|
||||
* @param aid 操作人
|
||||
* @param aname 操作人姓名
|
||||
*/
|
||||
void send(String title,String eventKey,String content,String objId,String objType,String objInfo,String aid,String aname,String author);
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.xboe.system.logs.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
@@ -9,16 +7,19 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.log.IAutoLogSave;
|
||||
import com.xboe.system.logs.dao.SysLogActionDao;
|
||||
import com.xboe.system.logs.entity.SysLogAction;
|
||||
import com.xboe.system.logs.service.ISysLogActionService;
|
||||
import com.xboe.system.logs.vo.SysLogActionVo;
|
||||
|
||||
//@Slf4j
|
||||
/**
|
||||
* 去掉 IAutoLogSave 接口的实现,采用统日志处理,如果需要记录,那就是加上实现的单独的日志保存
|
||||
* @author seastar
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class SysLogActionServiceImpl implements ISysLogActionService,IAutoLogSave{
|
||||
public class SysLogActionServiceImpl implements ISysLogActionService{
|
||||
|
||||
@Resource
|
||||
SysLogActionDao dao;
|
||||
@@ -50,18 +51,18 @@ public class SysLogActionServiceImpl implements ISysLogActionService,IAutoLogSav
|
||||
dao.setDeleted(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(String module, String actName, String actContent, String aid, String name) {
|
||||
|
||||
SysLogAction log=new SysLogAction();
|
||||
log.setModule(module);
|
||||
log.setActName(actName);
|
||||
log.setActTime(LocalDateTime.now());
|
||||
log.setActContent(actContent);
|
||||
log.setAid(aid);
|
||||
log.setName(name);
|
||||
dao.save(log);
|
||||
|
||||
}
|
||||
// @Override
|
||||
// public void save(String module, String actName, String actContent, String aid, String name) {
|
||||
//
|
||||
// SysLogAction log=new SysLogAction();
|
||||
// log.setModule(module);
|
||||
// log.setActName(actName);
|
||||
// log.setActTime(LocalDateTime.now());
|
||||
// log.setActContent(actContent);
|
||||
// log.setAid(aid);
|
||||
// log.setName(name);
|
||||
// dao.save(log);
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -86,6 +86,37 @@ public class UserApi extends ApiBaseController {
|
||||
return success(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户主页信息
|
||||
* @param aid
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/home",method = {RequestMethod.POST,RequestMethod.GET})
|
||||
public JsonResponse<Map<String,Object>> home(String aid) {
|
||||
|
||||
if(StringUtils.isBlank(aid)) {
|
||||
aid=getCurrent().getAccountId();
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(aid)) {
|
||||
return badRequest("无查询参数");
|
||||
}
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
//map.put("aid", aid);
|
||||
try {
|
||||
User u = userService.get(aid);
|
||||
if(u!=null) {
|
||||
map.put("showHome",u.getShowHome()==null ? true: u.getShowHome());
|
||||
}else {
|
||||
return badRequest("用户不存在");
|
||||
}
|
||||
return success(map);
|
||||
}catch(Exception e) {
|
||||
log.error("查询用户错误",e);
|
||||
return error("查询用户失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find",method = {RequestMethod.POST,RequestMethod.GET})
|
||||
public JsonResponse<List<User>> findByNameOrCode(String word) {
|
||||
if(StringUtils.isBlank(word)) {
|
||||
@@ -147,7 +178,10 @@ public class UserApi extends ApiBaseController {
|
||||
user.setDynamic(u.getDynamic());
|
||||
if (StringUtils.isNotBlank(user.getDepartId())) {
|
||||
Organization org = organizationService.get(user.getDepartId());
|
||||
user.setDepartName(org.getName());
|
||||
if(org!=null) {
|
||||
user.setDepartName(org.getName());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return success(user);
|
||||
|
||||
@@ -334,6 +334,8 @@ public class UserServiceImpl implements IUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Caching(evict = {@CacheEvict(value = CacheName.NAME_USER, key = "'" + CacheName.KEY_USER + "'+#id"),
|
||||
@CacheEvict(value = CacheName.NAME_USER, key = "'" + CacheName.KEY_USER_FILED + "'+#id")})
|
||||
public void updateShowHome(String id, Boolean showHome) {
|
||||
dao.updateFieldById(id,"showHome",showHome);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
<artifactId>xboe-redis</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-module-event</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.boe</groupId>
|
||||
<artifactId>httpsdk</artifactId>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.xboe.casetask.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.xboe.casetask.dao.CaseSyncCustomizeDao;
|
||||
@@ -25,6 +24,7 @@ import com.xboe.casetask.entity.DictItem;
|
||||
import com.xboe.casetask.service.ICaseSyncService;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.event.IEventDataSender;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.core.orm.UpdateBuilder;
|
||||
@@ -46,6 +46,9 @@ public class CaseSyncServiceImpl implements ICaseSyncService{
|
||||
|
||||
@Resource
|
||||
private UserDao userDao;
|
||||
|
||||
@Autowired(required = false)
|
||||
private IEventDataSender eventSender;
|
||||
|
||||
// @Override
|
||||
// @Transactional
|
||||
@@ -227,6 +230,11 @@ public class CaseSyncServiceImpl implements ICaseSyncService{
|
||||
}
|
||||
}
|
||||
recordDao.updateFieldById(csr.getId(), "caseId", c.getId());
|
||||
if(eventSender!=null) {
|
||||
eventSender.send("发布案例", "SyncCase",c.getTitle(), c.getId(), "3",c.getTitle(),c.getSysCreateAid(), c.getSysCreateBy(),"");
|
||||
}else {
|
||||
System.out.print("未配置事件消息发送的实现");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
162
servers/modify-user/pom.xml
Normal file
162
servers/modify-user/pom.xml
Normal file
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.3</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>modify-user</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>modify-user</name>
|
||||
<description>整理用户的数据问题</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- java-jwt -->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.18.3</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.b_c</groupId>
|
||||
<artifactId>jose4j</artifactId>
|
||||
<version>0.7.9</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- apache commons -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.27</version>
|
||||
<!-- <scope>runtime</scope> -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--加密配置文件-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>application-${profileActive}.properties</include>
|
||||
<include>application.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>*.properties</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>pro</id>
|
||||
<properties>
|
||||
<profileActive>pro</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>pre</id>
|
||||
<properties>
|
||||
<profileActive>pre</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>test</id>
|
||||
<properties>
|
||||
<profileActive>test</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<properties>
|
||||
<profileActive>dev</profileActive>
|
||||
</properties>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xboe;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
public class BoeBasicApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("jasypt.encryptor.password","jasypt");
|
||||
SpringApplication.run(BoeBasicApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xboe;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
/**
|
||||
* 返回的数据中如果是null 就会转化成空字符串
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class ResultNullToEmptyConfig {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConditionalOnMissingBean(ObjectMapper.class)
|
||||
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
|
||||
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
|
||||
objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() {
|
||||
@Override
|
||||
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
|
||||
throws IOException, JsonProcessingException {
|
||||
jsonGenerator.writeString("");
|
||||
}
|
||||
});
|
||||
return objectMapper;
|
||||
}
|
||||
}
|
||||
40
servers/modify-user/src/main/java/com/xboe/StartRunner.java
Normal file
40
servers/modify-user/src/main/java/com/xboe/StartRunner.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.xboe;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.xboe.basic.service.IModifyService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 启动执行一次
|
||||
* @author seastar
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class StartRunner implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
IModifyService service;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
//用于存放 kid=newId
|
||||
try {
|
||||
//本地 971783273423056896,971783831047385088
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("执行失败",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.exit(0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xboe.basic.api;
|
||||
|
||||
import com.xboe.core.JsonResponse;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/modify/user")
|
||||
public class ModifyApi {
|
||||
|
||||
|
||||
/**
|
||||
* 单独的更新一个用户的接口
|
||||
* */
|
||||
@GetMapping("/byid")
|
||||
public JsonResponse<Boolean> modifyUser(String id){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.Account;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
@Repository
|
||||
public class AccountDao extends BaseDao<Account>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.Teacher;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
@Repository
|
||||
public class TeacherDao extends BaseDao<Teacher>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.basic.entity.User;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
|
||||
@Repository
|
||||
public class UserDao extends BaseDao<User>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.xboe.basic.dao;
|
||||
|
||||
import com.xboe.basic.entity.UserRemoveLog;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class UserRemoveLogDao extends BaseDao<UserRemoveLog> {
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import com.xboe.core.orm.annotation.MetaInfo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 账号表,只是记录登录的账号信息,无任务业务实名类的信息
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "account")
|
||||
public class Account extends IdEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**0 临时数据*/
|
||||
public static final int STATUS_TEMPORARY=0;
|
||||
|
||||
/**1 正常数据*/
|
||||
public static final int STATUS_NORMAL=1;
|
||||
|
||||
/**2 停用数据*/
|
||||
public static final int STATUS_DEAD=2;
|
||||
|
||||
@MetaInfo("原系统中的id")
|
||||
@Column(name = "sys_id", length = 36)
|
||||
private String sysId;
|
||||
|
||||
@MetaInfo("登录名")
|
||||
@Column(name = "login_name", nullable = true, length = 30)
|
||||
private String loginName;
|
||||
|
||||
@MetaInfo("用户头像地址")
|
||||
@Column(name = "avatar", nullable = true, length = 100)
|
||||
private String avatar;
|
||||
|
||||
@MetaInfo("手机号")
|
||||
@Column(name = "mobile", length = 11)
|
||||
private String mobile;
|
||||
|
||||
// 状态1, 正常,2停用
|
||||
@Column(name = "status", length = 1)
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "deleted", length = 1)
|
||||
private Boolean deleted;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "teacher")
|
||||
public class Teacher extends IdEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 系统id
|
||||
*/
|
||||
@Column(name = "sys_id", length = 36)
|
||||
private String sysId;
|
||||
|
||||
|
||||
/**
|
||||
* 在职状态 在职: 0 离职: 1
|
||||
*/
|
||||
@Column(name = "wait_status")
|
||||
private Integer waitStatus;
|
||||
|
||||
|
||||
/**状态,0表临时, 1表启用,2表停用的*/
|
||||
@Column(name = "status",length = 1)
|
||||
private Integer status;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户信息表
|
||||
* 存储所有的用户信息,原表中的部分信息
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "user")
|
||||
public class User extends IdEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 旧系统id
|
||||
*/
|
||||
@Column(name = "sys_id", length = 36)
|
||||
private String sysId;
|
||||
|
||||
/**
|
||||
* 旧系统机构id
|
||||
*/
|
||||
@Column(name = "sys_depart_id", length = 36)
|
||||
private String sysDepartId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Column(name = "name", length = 30)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 员工编号
|
||||
*/
|
||||
@Column(name = "user_no", length = 30)
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 用户类型,1表学员,2表教师,3表管理员
|
||||
* 该字段暂用于表示是否前台管理员
|
||||
*/
|
||||
@Column(name = "user_type", length = 1)
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 学习总时长
|
||||
*/
|
||||
@Column(name = "study_total", length = 11)
|
||||
private Integer studyTotal;
|
||||
|
||||
/**
|
||||
* boe的时长,和系统时长单独保存
|
||||
*/
|
||||
@Column(name = "learning_Duration", length = 11)
|
||||
private Integer learningDuration;
|
||||
|
||||
/**
|
||||
* 最近一次登录时间
|
||||
*/
|
||||
@Column(name = "last_login_at")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastLoginAt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.xboe.basic.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 删除记录表
|
||||
* 1.对于已删除的记录做个备份 以防删除错误数据丢失
|
||||
* 2.对于未删除的记录,做一个说明
|
||||
* */
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE + "user_remove_log")
|
||||
public class UserRemoveLog extends IdEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
* */
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户的sysId
|
||||
* */
|
||||
@Column(name = "sys_id")
|
||||
private String sysId;
|
||||
|
||||
/**
|
||||
* 已删除的为true
|
||||
* 未删除的为false
|
||||
* */
|
||||
@Column(name = "removed")
|
||||
private Boolean removed;
|
||||
|
||||
/**
|
||||
* 未删除的原因
|
||||
* */
|
||||
@Column(name = "message")
|
||||
private String message;
|
||||
|
||||
|
||||
public UserRemoveLog() {
|
||||
}
|
||||
|
||||
public UserRemoveLog(String userId, String sysId, Boolean removed, String message) {
|
||||
this.userId = userId;
|
||||
this.sysId = sysId;
|
||||
this.removed = removed;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xboe.basic.service;
|
||||
|
||||
import com.xboe.basic.entity.Account;
|
||||
import com.xboe.basic.entity.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IModifyService {
|
||||
|
||||
|
||||
/**
|
||||
* 1.取出重复的数据
|
||||
* */
|
||||
List<Object[]> get();
|
||||
|
||||
|
||||
/**
|
||||
* 2.取出之后查出 老师身份的用户是不能删的,sysId不同工号相同的不能删 待确认
|
||||
* 无关联的用户或者少关联的用户,少关联的用户的数据记录下来,移到多的中
|
||||
* */
|
||||
Map<String,List<String>> find(List<Object[]> list);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 在删除前记录下来删除的用户,以防多删误删
|
||||
* */
|
||||
void saveUserRemove(List<User> userList);
|
||||
|
||||
/**
|
||||
* 标记删除和删除用户信息
|
||||
* */
|
||||
void remove(List<User> user, List<Account> accounts);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.xboe.basic.service.impl;
|
||||
|
||||
import com.xboe.basic.dao.AccountDao;
|
||||
import com.xboe.basic.dao.TeacherDao;
|
||||
import com.xboe.basic.dao.UserDao;
|
||||
import com.xboe.basic.dao.UserRemoveLogDao;
|
||||
import com.xboe.basic.entity.Account;
|
||||
import com.xboe.basic.entity.Teacher;
|
||||
import com.xboe.basic.entity.User;
|
||||
import com.xboe.basic.entity.UserRemoveLog;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.xboe.basic.service.IModifyService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* */
|
||||
@Service
|
||||
@Transactional
|
||||
public class ModifyServiceImpl implements IModifyService {
|
||||
|
||||
@Autowired
|
||||
UserDao userDao;
|
||||
|
||||
@Autowired
|
||||
AccountDao accountDao;
|
||||
|
||||
@Autowired
|
||||
TeacherDao teacherDao;
|
||||
|
||||
@Autowired
|
||||
UserRemoveLogDao removeLogDao;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 1.取出重复的数据
|
||||
*
|
||||
* */
|
||||
@Override
|
||||
public List<Object[]> get() {
|
||||
//查出用户所有重复的数据,只能采用sql查询
|
||||
String sql="select id,user_no,sys_id from boe_user where user_no in(select user_no from boe_user group by user_no having count(user_no)>1)";
|
||||
List<Object[]> list = userDao.sqlFindList(sql);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.取出之后查出 老师身份的用户是不能删的, 待确认 sysId不同工号相同的不能删
|
||||
* 无关联的用户或者少关联的用户,少关联的用户的数据记录下来,移到多的中
|
||||
* */
|
||||
@Override
|
||||
public Map<String,List<String>> find(List<Object[]> list) {
|
||||
//过滤掉已经是教师的,sysId不同的,同时记录下来
|
||||
// List<String> notDeleteIds = new ArrayList<>();
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
//要删除的
|
||||
List<String> deleteIds=new ArrayList<>();
|
||||
|
||||
//同时记录日志 要删的和不删的同时记录
|
||||
List<UserRemoveLog> userRemoveLogs = new ArrayList<>();
|
||||
|
||||
//sysId不同工号相同的不能删
|
||||
|
||||
for (Object[] o:list) {
|
||||
for (Object[] o1:list) {
|
||||
if(o[1].equals(o1[1])){
|
||||
if(!o[2].equals(o1[2])){
|
||||
// notDeleteIds.add((String) o[0]);
|
||||
// notDeleteIds.add((String) o1[0]);
|
||||
this.log(o[0].toString(),o[2].toString(),false,"同工号sysId不同,不能删除");
|
||||
this.log(o1[0].toString(),o1[2].toString(),false,"同工号sysId不同,不能删除");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//教师
|
||||
List<Teacher> teacherList = teacherDao.getAll();
|
||||
for (Teacher t:teacherList) {
|
||||
for (Object[] o:list) {
|
||||
if(t.getId().equals(o[0])){
|
||||
// notDeleteIds.add((String) o[0]);
|
||||
this.log(o[0].toString(),o[2].toString(),false,"该id已是教师身份,不能删除");
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*日志记录
|
||||
* */
|
||||
private UserRemoveLog log(String userId,String sysId,Boolean removed,String message){
|
||||
UserRemoveLog userRemoveLog = new UserRemoveLog(userId,sysId,removed,message);
|
||||
return userRemoveLog;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 在删除前记录下来删除的用户,以防多删误删
|
||||
* */
|
||||
@Override
|
||||
public void saveUserRemove(List<User> userList) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记删除和删除用户信息
|
||||
* */
|
||||
@Override
|
||||
public void remove(List<User> user, List<Account> accounts) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
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==)
|
||||
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
@@ -0,0 +1,23 @@
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
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==)
|
||||
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
@@ -0,0 +1,23 @@
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
spring.datasource.url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=admin
|
||||
spring.datasource.password=boeRds01
|
||||
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
@@ -0,0 +1,23 @@
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
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==)
|
||||
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
@@ -0,0 +1,52 @@
|
||||
spring.profiles.active=@profileActive@
|
||||
spring.application.name=boe-server-modify
|
||||
server.port=9196
|
||||
server.servlet.session.timeout=30m
|
||||
|
||||
|
||||
server.servlet.encoding.charset=UTF-8
|
||||
server.servlet.encoding.enabled=true
|
||||
server.servlet.encoding.force=true
|
||||
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
|
||||
|
||||
#spring.jackson.locale=
|
||||
#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||
# spring.jackson.default-property-inclusion=NON_NULL
|
||||
spring.jackson.time-zone=GMT+8
|
||||
|
||||
spring.servlet.multipart.max-file-size=1024MB
|
||||
spring.servlet.multipart.max-request-size=1024MB
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.mvc.static-path-pattern=/cdn/**
|
||||
|
||||
spring.redis.lettuce.pool.max-active=8
|
||||
spring.redis.lettuce.pool.min-idle=0
|
||||
spring.redis.lettuce.pool.max-idle=30
|
||||
spring.redis.lettuce.pool.max-wait=10000ms
|
||||
spring.redis.lettuce.shutdown-timeout=100ms
|
||||
|
||||
# 上传的临时目录,部署到服务器必须指定
|
||||
# spring.servlet.multipart.location=
|
||||
|
||||
# jpa config
|
||||
spring.jpa.database = MYSQL
|
||||
spring.jpa.show-sql = true
|
||||
# spring.jpa.properties.hibernate.cache.use_second_level_cache=true
|
||||
# spring.jpa.properties.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
|
||||
|
||||
spring.jpa.properties.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
#spring.transaction
|
||||
# spring.jpa.properties.hibernate.allow_update_outside_transaction=true
|
||||
# spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
||||
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
||||
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-@profileActive@.xml
|
||||
|
||||
|
||||
54
servers/modify-user/src/main/resources/log/logback-dev.xml
Normal file
54
servers/modify-user/src/main/resources/log/logback-dev.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="false">
|
||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
</configuration>
|
||||
55
servers/modify-user/src/main/resources/log/logback-pro.xml
Normal file
55
servers/modify-user/src/main/resources/log/logback-pro.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="false">
|
||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||
<property name="log.path" value="/home/logs/${spring.application.name}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="WARN">
|
||||
<appender-ref ref="debug"/>
|
||||
<appender-ref ref="error"/>
|
||||
</root>
|
||||
</configuration>
|
||||
55
servers/modify-user/src/main/resources/log/logback-test.xml
Normal file
55
servers/modify-user/src/main/resources/log/logback-test.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="false">
|
||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="debug"/>
|
||||
<appender-ref ref="error"/>
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user