mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 03:46:50 +08:00
Merge branch 's-master'
# Conflicts: # servers/boe-server-all/src/main/java/com/xboe/data/outside/OutSideDataServiceImpl.java # servers/boe-server-all/src/main/java/com/xboe/school/api/PortalLoginApi.java # servers/boe-server-all/src/main/resources/application-pro.properties
This commit is contained in:
@@ -28,6 +28,7 @@ public class CourseFullText {
|
||||
|
||||
/**10无目录录播课,20 有目录录播课,30:面授课;40学习项目*/
|
||||
private Integer type;
|
||||
|
||||
/**多个时用到*/
|
||||
private String types;
|
||||
|
||||
|
||||
@@ -99,7 +99,10 @@
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.system.ApplicationPid;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xboe.account.entity.Account;
|
||||
import com.xboe.account.service.IAccountService;
|
||||
import com.xboe.core.JsonResponse;
|
||||
@@ -45,9 +46,9 @@ public class UserDataSyncApi extends ApiBaseController {
|
||||
if (StringUtils.isBlank(user.getId())) {
|
||||
return error("无用户的id");
|
||||
}
|
||||
//清除缓存需要loginName
|
||||
try {
|
||||
//先查询是否存在
|
||||
ObjectMapper mapper=new ObjectMapper();
|
||||
log.info("同步的用户信息:{}",mapper.writeValueAsString(user));
|
||||
service.syncUserFull(user);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
@@ -65,9 +66,11 @@ public class UserDataSyncApi extends ApiBaseController {
|
||||
//清除缓存需要loginName
|
||||
try {
|
||||
//先查询是否存在
|
||||
log.info("删除用户【"+id+"】");
|
||||
Account a=new Account();
|
||||
a.setId(id);
|
||||
accountService.delete(a);
|
||||
log.info("删除用户成功");
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("同步删除用户错误", e);
|
||||
|
||||
@@ -55,6 +55,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
|
||||
json = mapper.writeValueAsString(params);
|
||||
String responseStr = okHttpUtil.doPostJson(url, json, headers);
|
||||
log.info("根据受众id获取受众的人员列表:",responseStr);
|
||||
JsonNode rootNode= mapper.readTree(responseStr);
|
||||
|
||||
JsonNode result = rootNode.get("result");
|
||||
@@ -96,8 +97,9 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
try {
|
||||
//OkHttpUtil http=new OkHttpUtil();
|
||||
String responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||
System.out.println("token:"+token);
|
||||
System.out.println("用户中心接口返回:"+responseStr);
|
||||
|
||||
log.info("获取用户信息:",responseStr);
|
||||
//System.out.println(responseStr);
|
||||
|
||||
JsonNode rootNode= mapper.readTree(responseStr);
|
||||
int code = rootNode.get("status").asInt();
|
||||
@@ -144,6 +146,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
user.setAdminType(2);//非默认管理员
|
||||
}
|
||||
if(roleCode.equals("teacher")){
|
||||
log.info("用户有教师身份");
|
||||
user.setTeacher(true);//是老师
|
||||
user.setUserType(2);//教师
|
||||
}
|
||||
@@ -177,6 +180,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
String responseStr=null;
|
||||
try{
|
||||
responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||
log.info("获取用户机构权限:",responseStr);
|
||||
JsonNode rootNode= mapper.readTree(responseStr);
|
||||
int code = rootNode.get("status").asInt();
|
||||
if(code!=200) {
|
||||
|
||||
@@ -19,6 +19,9 @@ import com.xboe.system.organization.entity.Organization;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import com.xboe.system.user.entity.User;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
|
||||
@@ -52,6 +55,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
a.setDeleted(user.getDeleted());
|
||||
}
|
||||
a.setLoginName(user.getCode());
|
||||
log.info("更新账号code");
|
||||
}else {
|
||||
//新账户
|
||||
a=new Account();
|
||||
@@ -62,6 +66,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
a.setRegTime(LocalDateTime.now());
|
||||
a.setSysId(user.getKid());
|
||||
a.setStatus(1);
|
||||
log.info("账号不存在,新添加账号【"+user.getId()+"】");
|
||||
}
|
||||
if(u!=null) {
|
||||
//更新部分用户字段
|
||||
@@ -73,6 +78,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
if(user.getLearningDuration()>0) { //不大于0才会更新
|
||||
u.setLearningDuration(user.getLearningDuration());
|
||||
}
|
||||
log.info("更新用户信息,学习时长,姓名,所在部门");
|
||||
}else {
|
||||
//新建用户
|
||||
u=new User();
|
||||
@@ -93,12 +99,13 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
}else {
|
||||
u.setShowHome(true);//band16以下,及其它无bandLevel的信息
|
||||
}
|
||||
|
||||
log.info("添加新用户");
|
||||
}
|
||||
//对机构的判断,不为空时才会处理,为空时不处理
|
||||
if(StringUtils.isNotBlank(user.getDepartId())) {
|
||||
org=orgDao.get(user.getDepartId());
|
||||
if(org==null) {
|
||||
log.info("无用户关联机构,添加新机构");
|
||||
org=new Organization();
|
||||
org.setCode("");
|
||||
org.setId(user.getDepartId());
|
||||
@@ -114,13 +121,17 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
|
||||
accountDao.saveOrUpdate(a);
|
||||
userDao.saveOrUpdate(u);
|
||||
userDao.flush();
|
||||
if(org!=null) {
|
||||
orgDao.saveOrUpdate(org);
|
||||
log.info("更新用户对应的机构信息");
|
||||
}
|
||||
//老师信息
|
||||
if(u.getUserType()!=null && u.getUserType()==2) {
|
||||
Teacher t = teacherDao.get(u.getId());
|
||||
log.info("用户有教师身份,处理教师身份");
|
||||
if(t==null) {
|
||||
log.info("添加教师身份");
|
||||
t=new Teacher();
|
||||
t.setId(u.getId());
|
||||
t.setDepartId(u.getDepartId());
|
||||
@@ -131,6 +142,7 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
t.setWaitStatus(0);
|
||||
t.setUser(u);
|
||||
teacherDao.save(t);
|
||||
log.info("教师身份已添加");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +252,7 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
for(Course c2 : clist) {
|
||||
if(c2.getId().equals(c.getId())) {
|
||||
c.setScore(c2.getScore());
|
||||
c.setStudies(c2.getStudys());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.common.utils.IDGenerator;
|
||||
@@ -447,8 +446,8 @@ public class AloneExamApi extends ApiBaseController {
|
||||
* @param aea
|
||||
* @return
|
||||
*/
|
||||
//@Deprecated
|
||||
@PostMapping("/start")
|
||||
@Deprecated
|
||||
public JsonResponse<AloneExamAnswer> startTest(HttpServletRequest request,@RequestBody AloneExamAnswer aea) {
|
||||
if (StringUtils.isBlank(aea.getPaperJson())) {
|
||||
return badRequest("参数试题内容");
|
||||
|
||||
@@ -58,6 +58,9 @@ public class ExamTestServiceImpl implements IExamTestService {
|
||||
@Override
|
||||
public ExamTest detail(String id) {
|
||||
ExamTest examTest = examTestDao.get(id);
|
||||
if(examTest==null) {
|
||||
return null;
|
||||
}
|
||||
Object field = examPaperDao.findField("testName", FieldFilters.eq("id", examTest.getPaperId()));
|
||||
if(field!=null){
|
||||
examTest.setPaperName((String) field);
|
||||
|
||||
@@ -2,14 +2,16 @@ package com.xboe.school.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
|
||||
@@ -206,10 +206,10 @@ public class PortalLoginApi extends ApiBaseController {
|
||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error 1");
|
||||
}
|
||||
|
||||
Map<String, String> tokenInfo = authorizationToken.readToken(token);
|
||||
if (tokenInfo == null) {
|
||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error 2");
|
||||
}
|
||||
// Map<String, String> tokenInfo = authorizationToken.readToken(token);
|
||||
// if (tokenInfo == null) {
|
||||
// return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
||||
// }
|
||||
|
||||
UserData udata=outsideService.getUserInfoByUserId(null);
|
||||
if(udata==null) {
|
||||
@@ -223,20 +223,20 @@ public class PortalLoginApi extends ApiBaseController {
|
||||
log.error("登录同步用户错误",exp);
|
||||
}
|
||||
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
// Map<String, String> data = new HashMap<String, String>();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
//模拟数据
|
||||
data.put("aid",udata.getId());
|
||||
data.put("uId", udata.getId());//匹配新的token中的 uId
|
||||
data.put("name", udata.getName());
|
||||
data.put("userNo", udata.getCode());
|
||||
data.put("departId", udata.getDepartId());
|
||||
data.put("userId",udata.getKid());
|
||||
// data.put("aid",udata.getId());
|
||||
// data.put("uId", udata.getId());//匹配新的token中的 uId
|
||||
// data.put("name", udata.getName());
|
||||
// data.put("userNo", udata.getCode());
|
||||
// data.put("departId", udata.getDepartId());
|
||||
// data.put("userId",udata.getKid());
|
||||
|
||||
String newtoken = authorizationToken.createToken(data);
|
||||
map.put("expires_in", IAuthorizationToken.TOKEN_TIMEOUT);
|
||||
map.put("scope", "boe");
|
||||
map.put("access_token", newtoken);
|
||||
// String newtoken = authorizationToken.createToken(data);
|
||||
// map.put("expires_in", IAuthorizationToken.TOKEN_TIMEOUT);
|
||||
// map.put("scope", "boe");
|
||||
// map.put("access_token", newtoken);
|
||||
//
|
||||
return success(map);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -8,11 +8,12 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -43,6 +44,24 @@ public class SysUploaderApi extends ApiBaseController{
|
||||
@Autowired
|
||||
XFileUploader uploader;
|
||||
|
||||
private static Set<String> fileTypeSet=new HashSet<>();
|
||||
static {
|
||||
fileTypeSet.add("mp3");
|
||||
fileTypeSet.add("wmv");
|
||||
fileTypeSet.add("mp4");
|
||||
fileTypeSet.add("jpg");
|
||||
fileTypeSet.add("png");
|
||||
fileTypeSet.add("gif");
|
||||
fileTypeSet.add("doc");
|
||||
fileTypeSet.add("docx");
|
||||
fileTypeSet.add("xls");
|
||||
fileTypeSet.add("xlsx");
|
||||
fileTypeSet.add("ppt");
|
||||
fileTypeSet.add("pptx");
|
||||
fileTypeSet.add("pdf");
|
||||
fileTypeSet.add("zip");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/file/upload", method = RequestMethod.POST)
|
||||
public JsonResponse<XUploadResult> save(HttpServletRequest request, String name,String dir) throws IOException {
|
||||
//以下三项用于回调
|
||||
@@ -59,10 +78,21 @@ public class SysUploaderApi extends ApiBaseController{
|
||||
if (file == null ) {
|
||||
return wrap(JsonResponseStatus.BAD_REQUEST, "未找到" + name + "对应的文件");
|
||||
}
|
||||
String type=".exe";
|
||||
if(StringUtil.isBlank(file.getOriginalFilename()) ||file.getOriginalFilename().endsWith(type.toUpperCase()) || file.getOriginalFilename().endsWith(type)){
|
||||
return badRequest("不支持此格式");
|
||||
String suffix=file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
|
||||
if(StringUtils.isBlank(suffix)) {
|
||||
return wrap(JsonResponseStatus.BAD_REQUEST, "文件类型错误");
|
||||
}
|
||||
//上传限制文件类型
|
||||
suffix=suffix.toLowerCase();
|
||||
if(!fileTypeSet.contains(suffix)) {
|
||||
return wrap(JsonResponseStatus.BAD_REQUEST, "不支持的文件类型");
|
||||
}
|
||||
|
||||
//限制上传的类型 mp3,mp3,doc,docx,ppt,pptx,pdf
|
||||
// String type=".exe";
|
||||
// if(StringUtil.isBlank(file.getOriginalFilename()) ||file.getOriginalFilename().endsWith(type.toUpperCase()) || file.getOriginalFilename().endsWith(type)){
|
||||
// return badRequest("不支持此格式");
|
||||
// }
|
||||
|
||||
if(StringUtils.isBlank(dir)) {
|
||||
dir="";
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Message extends IdEntity {
|
||||
private String pageUrl;
|
||||
|
||||
/**
|
||||
* 页面类型
|
||||
* 页面类型,1课程学习页面,2文章详细页面,3 表案例详细页面,4表问答详细页面
|
||||
* */
|
||||
@Column(name = "page_type",length = 1)
|
||||
private Integer pageType;
|
||||
|
||||
@@ -17,9 +17,19 @@ spring.redis.port=6379
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
|
||||
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
|
||||
## 使用 hikari 连接池
|
||||
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
||||
spring.datasource.hikari.auto-commit: true
|
||||
spring.datasource.hikari.minimum-idle=5
|
||||
spring.datasource.hikari.idle-timeout=60000
|
||||
spring.datasource.hikari.connection-timeout=30000
|
||||
spring.datasource.hikari.max-lifetime=1800000
|
||||
spring.datasource.hikari.maximum-pool-size=20
|
||||
|
||||
|
||||
logging.level.org.hibernate.SQL=ERROR
|
||||
# logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
@@ -12,6 +12,15 @@ spring.datasource.url=jdbc:mysql://10.251.160.40:3306/boe_base?useSSL=false&useU
|
||||
spring.datasource.username=admin
|
||||
spring.datasource.password=boeRds01
|
||||
|
||||
## 使用 hikari 连接池
|
||||
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
||||
spring.datasource.hikari.auto-commit: true
|
||||
spring.datasource.hikari.minimum-idle=5
|
||||
spring.datasource.hikari.idle-timeout=60000
|
||||
spring.datasource.hikari.connection-timeout=30000
|
||||
spring.datasource.hikari.max-lifetime=1800000
|
||||
spring.datasource.hikari.maximum-pool-size=20
|
||||
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
|
||||
@@ -50,5 +50,6 @@
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="debug"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
||||
Reference in New Issue
Block a user