mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 19:06:49 +08:00
合并解决冲突
This commit is contained in:
@@ -14,9 +14,30 @@
|
||||
<name>boe-server-all</name>
|
||||
<description>BOE 项目所有功能启动工程,用于开发</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
||||
<nacos-client.version>2.2.0</nacos-client.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- 引入Cloud -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-client</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-client</artifactId>
|
||||
<version>${nacos-client.version}</version>
|
||||
</dependency>
|
||||
<!-- end -->
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-api</artifactId>
|
||||
|
||||
@@ -23,6 +23,7 @@ public class UrlSecurityFilterImpl implements IUrlSecurityFilter{
|
||||
noLoginUrls.add("/xboe/account/captcha");
|
||||
noLoginUrls.add("/xboe/account/login");
|
||||
noLoginUrls.add("/xboe/account/boelogin");
|
||||
noLoginUrls.add("/xboe/account/boenewlogin");
|
||||
noLoginUrls.add("/xboe/account/mobile-login");
|
||||
noLoginUrls.add("/xboe/account/logout");
|
||||
noLoginUrls.add("/xboe/system/captcha");
|
||||
|
||||
@@ -16,7 +16,7 @@ public class UserData {
|
||||
/**主要是为了兼容之前的使用,新用户可以为空*/
|
||||
private String kid;
|
||||
|
||||
/**用户工号*/
|
||||
/**用户工号,用于登录名*/
|
||||
private String code;
|
||||
|
||||
private String mobile;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import com.xboe.data.dto.AudienceUser;
|
||||
import com.xboe.data.dto.UserData;
|
||||
import com.xboe.data.dto.UserOrgIds;
|
||||
import com.xboe.system.user.vo.UserSimpleVo;
|
||||
|
||||
public interface IOutSideDataService {
|
||||
|
||||
@@ -17,12 +18,27 @@ public interface IOutSideDataService {
|
||||
/**
|
||||
* 通过统一用户id获取用户的信息,如果是空,就是当前登录的用户
|
||||
*/
|
||||
UserData getUserInfoByUserId(String userId);
|
||||
UserData getUserInfoByToken(String token);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户有权限的机构id
|
||||
* */
|
||||
*/
|
||||
UserOrgIds getOrgIds();
|
||||
|
||||
/**
|
||||
* 根据aid集合,从用户中心获取要显示的用户信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<UserSimpleVo> findByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 更新用户的头像,签名
|
||||
* @param aid
|
||||
* @param avatar
|
||||
* @param sign
|
||||
*/
|
||||
void updateUser(String aid,String avatar,String sign);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.xboe.core.utils.OkHttpUtil;
|
||||
import com.xboe.data.dto.AudienceUser;
|
||||
import com.xboe.data.dto.UserData;
|
||||
import com.xboe.data.dto.UserOrgIds;
|
||||
import com.xboe.system.user.vo.UserSimpleVo;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -42,7 +43,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
@Override
|
||||
public List<AudienceUser> getUsersByAudienceId(String audienceId){
|
||||
|
||||
String token = TokenProxy.getToken(request);
|
||||
String token = TokenProxy.getBoeToken(request);
|
||||
String type="application/json";
|
||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||
String url= getBaseUrl("/audience/members");
|
||||
@@ -85,9 +86,10 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
// }
|
||||
|
||||
@Override
|
||||
public UserData getUserInfoByUserId(String userId) {
|
||||
|
||||
String token = TokenProxy.getBoeToken(request);
|
||||
public UserData getUserInfoByToken(String token) {
|
||||
//String token = TokenProxy.getBoeToken(request);
|
||||
|
||||
log.info("请求/userbasic/user/info");
|
||||
//String token="eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzIxMTI3NTUsImV4cCI6MTY3MjExOTk1NSwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.1348e0cfbb064d6d348d3976db3618974c1b1e8d2f6c6f45ae8294f09223f9b1";
|
||||
String type="application/json";
|
||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||
@@ -97,8 +99,10 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
try {
|
||||
//OkHttpUtil http=new OkHttpUtil();
|
||||
String responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||
|
||||
log.info("获取用户信息:",responseStr);
|
||||
if(StringUtils.isBlank(responseStr)) {
|
||||
log.error("获取/userbasic/user/info返回空值");
|
||||
}
|
||||
//log.info("获取用户信息:"+responseStr);
|
||||
//System.out.println(responseStr);
|
||||
|
||||
JsonNode rootNode= mapper.readTree(responseStr);
|
||||
@@ -111,7 +115,7 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
JsonNode result = rootNode.get("result");
|
||||
if(result!=null && result.isObject()) {
|
||||
//这里应该是单独的线程去处理
|
||||
user.setId(getNodeText(result.get("id")));
|
||||
user.setId(getNodeText(result.get("userId")));//最新接口变化,id改成userId
|
||||
String band=getNodeText(result.get("bandCode"));
|
||||
if(StringUtils.isNotBlank(band) && band.length()>4) {
|
||||
String bandNum=band.substring(4);
|
||||
@@ -121,45 +125,94 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
}
|
||||
user.setAvatar(getNodeText(result.get("avatar")));
|
||||
user.setCode(getNodeText(result.get("userNo")));
|
||||
|
||||
if(StringUtils.isBlank(user.getCode())) {
|
||||
user.setCode(getNodeText(result.get("loginName")));
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(user.getCode())) {
|
||||
log.error("通过接口获取当前用户信息【"+user.getId()+"】"+user.getName()+",工号或登录名为空,不能使用");
|
||||
throw new RuntimeException("通过接口获取当前用户信息,工号为空,不能使用");
|
||||
}
|
||||
|
||||
|
||||
user.setName(result.get("realName").asText());
|
||||
//user.setDeleted(result.get("deleted").asBoolean());//无此字段
|
||||
user.setDeleted(false);
|
||||
user.setDepartId(getNodeText(result.get("departId")));
|
||||
user.setDepartName(getNodeText(result.get("departName")));//无此字段
|
||||
user.setGender(result.get("gender").asInt());//
|
||||
user.setDepartId(getNodeText(result.get("orgId")));//最新departId改为orgId
|
||||
user.setDepartName(getNodeText(result.get("orgName")));//无此字段
|
||||
user.setOrgNamePath(result.get("orgNamePath").asText());
|
||||
//新的接口中没有这个字段了,设置为默认是1 20230622
|
||||
//user.setGender(result.get("gender").asInt());//
|
||||
//别是1.男;2.女;3其他;4.保密 20230626
|
||||
int gender=result.get("gender").asInt();
|
||||
if(gender>2) {
|
||||
gender=1;
|
||||
}
|
||||
user.setGender(gender);
|
||||
|
||||
user.setKid(getNodeText(result.get("kid")));
|
||||
user.setLearningDuration(result.get("learningDuration").asInt());
|
||||
user.setName(result.get("realName").asText());
|
||||
user.setOrgNamePath(result.get("orgName").asText());
|
||||
//新的字段里没有此字段了,这里设置为0
|
||||
//user.setLearningDuration(result.get("learningDuration").asInt());
|
||||
//user.setLearningDuration(0);
|
||||
//改为判断
|
||||
JsonNode learningNode=result.get("learningDuration");
|
||||
if(learningNode!=null) {
|
||||
user.setLearningDuration(learningNode.asInt());
|
||||
}else {
|
||||
user.setLearningDuration(0);
|
||||
}
|
||||
|
||||
user.setUserType(1);//直接设置为学员
|
||||
user.setTeacher(false);
|
||||
|
||||
user.setAdminType(0);
|
||||
user.setSysAdmin(result.get("isSystemAdmin").asBoolean());
|
||||
//前端身份
|
||||
JsonNode permissions = result.get("permissionList");
|
||||
Iterator<JsonNode> permissionNodes=permissions.elements();
|
||||
while(permissionNodes.hasNext()) {
|
||||
JsonNode permission=permissionNodes.next();
|
||||
String permissionText=permission.asText();
|
||||
if("front-admin".equals(permissionText)) {
|
||||
//log.info("用户是默认管理员");
|
||||
user.setAdminType(1);//设置为管理员,但是是非默认管理员
|
||||
}else if("front-teacher".equals(permissionText)) {
|
||||
//log.info("用户有教师身份");
|
||||
user.setTeacher(true);//设置为教师
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//处理roleList ,主要是提取默认管理员,非默认管理员,20230627修改
|
||||
JsonNode roleList = result.get("roleList");
|
||||
if(roleList!=null){
|
||||
for(JsonNode jsonNode :roleList) {
|
||||
String roleCode=getNodeText(jsonNode.get("code"));
|
||||
if(roleCode.equals("system-admin")){
|
||||
user.setSysAdmin(true);//系统管理员
|
||||
}
|
||||
//修改为只是设置默认管理员
|
||||
if(roleCode.equals("learning-admin")){
|
||||
user.setAdminType(1);//默认管理员
|
||||
}else if(roleCode.equals("non-default-admin")) {
|
||||
user.setAdminType(2);//非默认管理员
|
||||
}
|
||||
if(roleCode.equals("teacher")){
|
||||
log.info("用户有教师身份");
|
||||
user.setTeacher(true);//是老师
|
||||
user.setUserType(2);//教师
|
||||
}
|
||||
|
||||
// if(roleCode.equals("system-admin")){
|
||||
// user.setSysAdmin(true);//系统管理员
|
||||
// }
|
||||
// if(roleCode.equals("learning-admin")){
|
||||
// user.setAdminType(1);//默认管理员
|
||||
// }else if(roleCode.equals("non-default-admin")) {
|
||||
// user.setAdminType(2);//非默认管理员
|
||||
// }
|
||||
// if(roleCode.equals("teacher")){
|
||||
// log.info("用户有教师身份");
|
||||
// user.setTeacher(true);//是老师
|
||||
// user.setUserType(2);//教师
|
||||
// }
|
||||
}
|
||||
}
|
||||
if(StringUtils.isBlank(user.getCode())) {
|
||||
log.error("通过接口获取当前用户信息【"+user.getId()+"】"+user.getName()+",工号为空,不能使用");
|
||||
throw new RuntimeException("通过接口获取当前用户信息,工号为空,不能使用");
|
||||
}
|
||||
|
||||
}else {
|
||||
log.error("通过接口获取用户信息结果result错误:"+responseStr);
|
||||
throw new RuntimeException("通过接口获取用户信息结果result错误");
|
||||
}
|
||||
//System.out.println("用户管理员:"+user.getAdminType());
|
||||
//System.out.println("老师:"+user.getTeacher());
|
||||
return user;
|
||||
} catch (Exception e) {
|
||||
log.error("获取当前用户信息错误",e);
|
||||
@@ -194,14 +247,23 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
uids.getPermissions().put(UserOrgIds.IsSystemAdminKey, isAdminNode.asBoolean());
|
||||
}
|
||||
}
|
||||
//根据最新接口修正20230622 result返回的两个数组,mainList ,readOnlyList,只是使用 mainList
|
||||
// if(rootNode.get("result")!=null & rootNode.get("result").isArray()) {
|
||||
// JsonNode result = rootNode.get("result");
|
||||
// Iterator<JsonNode> elements = result.elements();
|
||||
// while (elements.hasNext()){
|
||||
// orgIds.add(elements.next().toString());
|
||||
// }
|
||||
// }
|
||||
|
||||
if(rootNode.get("result")!=null & rootNode.get("result").isArray()) {
|
||||
JsonNode result = rootNode.get("result");
|
||||
if(rootNode.get("result")!=null & rootNode.get("result").get("mainList")!=null) {
|
||||
JsonNode result = rootNode.get("result").get("mainList");
|
||||
Iterator<JsonNode> elements = result.elements();
|
||||
while (elements.hasNext()){
|
||||
orgIds.add(elements.next().toString());
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("获取当前用户有权限的机构id错误",e);
|
||||
}
|
||||
@@ -209,72 +271,6 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
//// List<String> orgIds = new ArrayList<>();
|
||||
//// String token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzUzMDkxMDcsImV4cCI6MTY3NTMxNjMwNywiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjdFMDY1NzQxLTkzRUItRTc1Ni02Mzk5LUIwQTA1QUY2NEE3OSIsInVJZCI6Ijk2NTM2OTU4MjM5Mjk3MTI2NCIsInBlcm1pc3Npb24iOiIifQ==.6780daf88206d3f4f2cfc184268f4c1b80f25a916105219a5a6f2e904762b1e8";
|
||||
//// String type="application/json";
|
||||
//// String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||
//// String url= ("https://u.boe.com/userbasic/org/manageOrgIds");
|
||||
//// ObjectMapper mapper=new ObjectMapper();
|
||||
//// String responseStr=null;
|
||||
//// try{
|
||||
//// OkHttpUtil http=new OkHttpUtil();
|
||||
//// responseStr = http.doPostJson(url,"{}", headers);
|
||||
//// System.out.println(responseStr);
|
||||
//// JsonNode rootNode= mapper.readTree(responseStr);
|
||||
//// int code = rootNode.get("status").asInt();
|
||||
//// System.out.println("code="+code);
|
||||
//// if(code!=200) {
|
||||
//// log.error("获取当前用户拥有权限机构id错误:"+responseStr);
|
||||
//// }
|
||||
////
|
||||
//// if(rootNode.get("result")!=null & rootNode.get("result").isArray()) {
|
||||
//// JsonNode result = rootNode.get("result");
|
||||
//// Iterator<JsonNode> elements = result.elements();
|
||||
//// while (elements.hasNext()){
|
||||
//// orgIds.add(elements.next().toString());
|
||||
//// }
|
||||
//// }
|
||||
//// for(String str : orgIds) {
|
||||
//// System.out.println(str);
|
||||
//// }
|
||||
//// }catch (Exception e){
|
||||
//// log.error("获取当前用户有权限的机构id错误",e);
|
||||
//// }
|
||||
// String token="eyJhbGciOiJIUzI1NiIsInR5cGUiOiJ0b2tlbiJ9.eyJpc3MiOiJodHRwOi8vdS5ib2UuY29tIiwiR2l2ZW5OYW1lIjoiYm9ldSIsInVJZCI6OTY1MzQyMDI3NDk3NjA3MTY4LCJ1c2VySWQiOiI2QjA0OUZBRi1DMzE0LTdDQ0YtMEQyOC0wRDIzRjRDNDI1MzEiLCJleHAiOjE2NzUzMzUxNTU3MTZ9.d9f78b2c6bac6001f732015f509eff04f50c6a426e7c01f259f884c8da6ac92c";
|
||||
// String url= "https://u-pre.boe.com/userbasic/audience/members";
|
||||
// Map<String, String> params = new HashMap<>();
|
||||
// params.put("audienceId", "7008604893867151361");
|
||||
// String json = null;
|
||||
// List<AudienceUser> list=new ArrayList<AudienceUser>();
|
||||
// ObjectMapper mapper=new ObjectMapper();
|
||||
// try {
|
||||
//
|
||||
// json = mapper.writeValueAsString(params);
|
||||
// OkHttpUtil http=new OkHttpUtil();
|
||||
// String[] headers=new String[] {"token",token,"Content-Type","application/json"};
|
||||
// String responseStr = http.doPostJson(url, json, headers);
|
||||
// System.out.println(responseStr);
|
||||
// JsonNode rootNode= mapper.readTree(responseStr);
|
||||
//
|
||||
// JsonNode result = rootNode.get("result");
|
||||
// if(result!=null && result.isArray()) {
|
||||
// //这里应该是单独的线程去处理
|
||||
// for(JsonNode node :result) {
|
||||
// AudienceUser au=new AudienceUser();
|
||||
// au.setId(node.get("userId").asText());
|
||||
// au.setName(node.get("name").asText());
|
||||
// au.setCode(node.get("userNo").asText());
|
||||
// list.add(au);
|
||||
// System.out.println(au.getName());
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取受众用户列表错误",e);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
private String getBaseUrl(String url) {
|
||||
String baseUrl=SysConstant.getConfigValue("xboe.server.userbasic.url");
|
||||
if(StringUtils.isBlank(baseUrl)) {
|
||||
@@ -285,4 +281,102 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
return reqUrl;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<UserSimpleVo> findByIds(List<String> ids) {
|
||||
|
||||
//请求信息,token加在header中
|
||||
String token = TokenProxy.getToken(request);
|
||||
String type="application/json";
|
||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||
String url= getBaseUrl("/user/getUserMessageToDai");
|
||||
//返回信息
|
||||
List<UserSimpleVo> uids=new ArrayList<UserSimpleVo>();
|
||||
ObjectMapper mapper=new ObjectMapper();
|
||||
String responseStr=null;
|
||||
try{
|
||||
Map<String,Object> params=new HashMap<String,Object>();
|
||||
params.put("userIdList",ids);
|
||||
String idsJson=mapper.writeValueAsString(params);
|
||||
log.info("请求的的接口:"+url);
|
||||
log.info("请求的数据:"+idsJson);
|
||||
responseStr = okHttpUtil.doPostJson(url,idsJson, headers);
|
||||
if(StringUtils.isBlank(responseStr)) {
|
||||
log.error("接口未返回任何内容");
|
||||
return null;
|
||||
}
|
||||
//log.info("返回的数据:"+responseStr);
|
||||
JsonNode rootNode= mapper.readTree(responseStr);
|
||||
int code = rootNode.get("status").asInt();
|
||||
if(code!=200) {
|
||||
log.error("根据aid集合获取用户信息错误:"+code);
|
||||
return null;
|
||||
}
|
||||
|
||||
//返回的是集合
|
||||
JsonNode result = rootNode.get("result");
|
||||
if(result!=null && result.isArray()) {
|
||||
|
||||
Iterator<JsonNode> elements = result.elements();
|
||||
while (elements.hasNext()){
|
||||
JsonNode node=elements.next();
|
||||
UserSimpleVo vo=new UserSimpleVo();
|
||||
vo.setAid(node.get("aid").asText());
|
||||
vo.setAvatar(getNodeText(node.get("avatar")));
|
||||
vo.setCode(getNodeText(node.get("code")));
|
||||
vo.setName(getNodeText(node.get("name")));
|
||||
vo.setOrgInfo(getNodeText(node.get("orgInfo")));
|
||||
vo.setSign(getNodeText(node.get("sign")));
|
||||
//别是1.男;2.女;3其他;4.保密 20230626
|
||||
if(node.get("sex")==null) {
|
||||
log.error("根据aid集合获取用户信息错误[性别字段sex为空]:"+code);
|
||||
vo.setSex(1);
|
||||
}else {
|
||||
int gender=node.get("sex").asInt();
|
||||
if(gender>2) {
|
||||
gender=1;
|
||||
}
|
||||
vo.setSex(gender);
|
||||
}
|
||||
|
||||
|
||||
uids.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("根据aid集合获取用户信息错误",e);
|
||||
}
|
||||
return uids;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateUser(String aid, String avatar, String sign) {
|
||||
|
||||
String token = TokenProxy.getToken(request);
|
||||
String type="application/json";
|
||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||
String url= getBaseUrl("/org/updateUserMessage");
|
||||
//返回信息
|
||||
ObjectMapper mapper=new ObjectMapper();
|
||||
String responseStr=null;
|
||||
try{
|
||||
String postJson="{\"aid\":\""+aid+"\",\"avatar\":\""+avatar+"\",\"sign\":\""+sign+"\"}";
|
||||
log.info("请求的的接口:"+url);
|
||||
log.info("请求的数据:"+postJson);
|
||||
responseStr = okHttpUtil.doPostJson(url,postJson, headers);
|
||||
log.info("返回的数据:"+responseStr);
|
||||
JsonNode rootNode= mapper.readTree(responseStr);
|
||||
int code = rootNode.get("status").asInt();
|
||||
if(code!=200) {
|
||||
log.error("根据ai更新用户信息错误:"+code);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("根据aid更新用户信息错误",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -247,11 +247,13 @@ public class CourseFileApi extends ApiBaseController {
|
||||
}
|
||||
String fileFullPath = SysConstant.getConfigValue(BaseConstant.CONFIG_UPLOAD_FILES_SAVEPATH) + file.getFilePath();
|
||||
if ("mp3,mp4".indexOf(file.getFileType()) > -1){
|
||||
log.info("上传 "+file.getFileType()+"文件:"+file.getFilePath());
|
||||
Encoder encoder = new Encoder();
|
||||
try {
|
||||
//System.out.println(fileFullPath);
|
||||
MultimediaInfo m = encoder.getInfo(new File(fileFullPath));
|
||||
Long ls = m.getDuration() / 1000;//秒
|
||||
log.info("文件时长 "+ls);
|
||||
//System.out.print("视频时长:" + ls + "秒");
|
||||
file.setDuration(ls.intValue());
|
||||
if("mp3".equals(file.getFileType())){// mp3
|
||||
@@ -260,7 +262,7 @@ public class CourseFileApi extends ApiBaseController {
|
||||
file.setDecoder(m.getVideo().getDecoder());
|
||||
file.setVideoHeight(m.getVideo().getSize().getHeight());
|
||||
file.setVideoWidth(m.getVideo().getSize().getWidth());
|
||||
|
||||
log.info("文件的编码 "+file.getDecoder());
|
||||
if(StringUtils.isBlank(file.getDecoder()) || !file.getDecoder().equals("h264")) {
|
||||
log.error("编码格式不是h264,不能上传");
|
||||
return error("编码格式不是h264,请先转码再上传","");
|
||||
|
||||
@@ -535,7 +535,7 @@ public class CourseManageApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
|
||||
private String createEmailHtml(String name,String orgId, String orgName,String createBy,String courseName) {
|
||||
private String createEmailHtml(String name,String orgId, String orgName,String createBy,String courseName) throws Exception {
|
||||
StringBuffer htmlMsg=new StringBuffer("<div style=\"line-height:30px;border:2px solid #2990ca;padding:20px\">");
|
||||
|
||||
htmlMsg.append("<div style=\"height:60px; font-size:30px;text-align:right;font-weight: 200;\">BOE学习平台</div>");
|
||||
@@ -549,8 +549,9 @@ public class CourseManageApi extends ApiBaseController{
|
||||
orgInfo=" <span style=\"font-weight: 700;\">"+orgName+"</span> ";
|
||||
}else {
|
||||
//根据orgId获取
|
||||
Organization organ = orgService.get(orgId);
|
||||
orgInfo=" <span style=\"font-weight: 700;\">"+organ.getNamePath()+"</span> ";
|
||||
// Organization organ = orgService.get(orgId);
|
||||
// orgInfo=" <span style=\"font-weight: 700;\">"+organ.getNamePath()+"</span> ";
|
||||
throw new Exception("无组织机构路径");
|
||||
|
||||
}
|
||||
htmlMsg.append("<div>您负责的"+orgInfo+"组织下, <span style=\"font-weight: 700;\">"+createBy+"</span> 提交了一门课程 <span style=\"font-weight: 700;\">"+courseName+" </span>,需要您审核,\r\n"
|
||||
@@ -579,7 +580,7 @@ public class CourseManageApi extends ApiBaseController{
|
||||
// }
|
||||
|
||||
Course course = courseService.get(audit.getCourseId());
|
||||
if(StringUtils.isBlank(course.getOrgId())) {
|
||||
if(StringUtils.isBlank(course.getOrgId())){
|
||||
return badRequest("请先在课程开发中配置用户");
|
||||
}
|
||||
String error=checkForSubmit(course);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.xboe.school.api;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@@ -14,6 +16,7 @@ import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.core.api.TokenProxy;
|
||||
import com.xboe.data.dto.UserData;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.module.teacher.service.ITeacherService;
|
||||
@@ -53,7 +56,7 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/init",method = {RequestMethod.GET})
|
||||
public JsonResponse<Map<String,Object>> init() {
|
||||
public JsonResponse<Map<String,Object>> init(HttpServletRequest request) {
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
try {
|
||||
CurrentUser cuser=getCurrent();
|
||||
@@ -62,26 +65,28 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
log.error("未找到账号id【"+getCurrent().getAccountId()+"】对应的用户");
|
||||
return error("账号错误,无此账号");
|
||||
}
|
||||
|
||||
UserData userData = outsideDataService.getUserInfoByUserId(null);
|
||||
String token = TokenProxy.getBoeToken(request);
|
||||
UserData userData = outsideDataService.getUserInfoByToken(token);
|
||||
if(userData==null) {
|
||||
log.error("通过api获取用用户信息错误【"+getCurrent().getAccountId()+"】对应的用户");
|
||||
//return error("未能获取当前用户信息");
|
||||
return error("未能获取当前用户信息");
|
||||
}
|
||||
|
||||
User user = userService.get(getCurrent().getAccountId());
|
||||
Organization org = null;
|
||||
|
||||
String departName = "";
|
||||
String departFullName = "";
|
||||
if(StringUtil.isNotBlank(user.getDepartId())) {
|
||||
org = organizationService.get(user.getDepartId());
|
||||
if(org!=null) {
|
||||
departName = org.getName();
|
||||
if(StringUtil.isNotBlank(org.getNamePath())) {
|
||||
departFullName = org.getNamePath().substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
String departFullName = userData.getOrgNamePath();
|
||||
|
||||
// Organization org = null;
|
||||
// if(StringUtil.isNotBlank(user.getDepartId())) {
|
||||
// org = organizationService.get(user.getDepartId());
|
||||
// if(org!=null) {
|
||||
// departName = org.getName();
|
||||
// if(StringUtil.isNotBlank(org.getNamePath())) {
|
||||
// departFullName = org.getNamePath().substring(1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//检查是否是教师,并计算用户的类型,修改于220507
|
||||
|
||||
// Teacher t = teacherService.get(account.getId());
|
||||
@@ -107,8 +112,7 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
//以下是使用的接口数据判断身份
|
||||
int utype=1;//仅仅是学员
|
||||
if(userData!=null) {
|
||||
|
||||
if(userData.getTeacher()) {
|
||||
if(userData.getTeacher()!=null && userData.getTeacher()) {
|
||||
utype=2;
|
||||
}
|
||||
if(userData.getAdminType()>0) {
|
||||
|
||||
@@ -211,7 +211,7 @@ public class PortalLoginApi extends ApiBaseController {
|
||||
// return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
||||
// }
|
||||
|
||||
UserData udata=outsideService.getUserInfoByUserId(null);
|
||||
UserData udata=outsideService.getUserInfoByToken(token);
|
||||
if(udata==null) {
|
||||
log.error("未获取当前登录人的用户信息");
|
||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "用户信息查询失败");
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SysConsoleApi extends ApiBaseController{
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
//获取当前用户数据
|
||||
CurrentUser cu=super.getCurrent();
|
||||
map.put("msg",2);//未读消息提示是0
|
||||
map.put("msg",0);//未读消息提示是0
|
||||
map.put("aid",cu.getAccountId());//
|
||||
map.put("name",cu.getName());//
|
||||
map.put("avatar","");//头像,如果没有就提供一个默认的
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.xboe.system.user.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -24,6 +23,7 @@ import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.constants.Constants;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.externalinterface.system.service.IFwUserService;
|
||||
import com.xboe.module.teacher.entity.Teacher;
|
||||
import com.xboe.module.teacher.service.ITeacherService;
|
||||
@@ -61,6 +61,9 @@ public class UserApi extends ApiBaseController {
|
||||
|
||||
@Resource
|
||||
IUserService userService;
|
||||
|
||||
@Resource
|
||||
IOutSideDataService outsideService;
|
||||
|
||||
/**
|
||||
* 分页查询用户信息
|
||||
@@ -255,17 +258,31 @@ public class UserApi extends ApiBaseController {
|
||||
public JsonResponse<List<UserSimpleVo>> findByIds(@RequestBody List<String> ids) {
|
||||
|
||||
List<UserSimpleVo> list = null;
|
||||
//最后从缓存中取,根据用户的id, 缓存用户的头像地址,姓名,机构信息。一期可以先直接查询,缓存可以后续修改
|
||||
if (ids != null && ids.size() > 0) {
|
||||
list = new ArrayList<>();
|
||||
for (String id : ids) {
|
||||
Account account = accountService.get(id);
|
||||
UserSimpleVo vo = getAuthorVo(account);
|
||||
if (vo != null) {
|
||||
list.add(vo);
|
||||
}
|
||||
}
|
||||
// //最后从缓存中取,根据用户的id, 缓存用户的头像地址,姓名,机构信息。一期可以先直接查询,缓存可以后续修改
|
||||
// if (ids != null && ids.size() > 0) {
|
||||
// list = new ArrayList<>();
|
||||
// for (String id : ids) {
|
||||
// Account account = accountService.get(id);
|
||||
// UserSimpleVo vo = getAuthorVo(account);
|
||||
// if (vo != null) {
|
||||
// list.add(vo);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//从用户中心接口中获取
|
||||
try {
|
||||
list=outsideService.findByIds(ids);
|
||||
if(list==null) {
|
||||
log.error("根据id集合从用户中心获取用户数据失败,请查看日志");
|
||||
return badRequest("根据id集合从用户中心获取用户数据失败,请查看日志");
|
||||
}
|
||||
}catch(Exception e) {
|
||||
log.error("从用户中心获取用户信息失败",e);
|
||||
return badRequest("从用户中心获取用户信息失败");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
# cloud nacos config
|
||||
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
|
||||
|
||||
## datasource config
|
||||
spring.jpa.show-sql = true
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
## redis
|
||||
spring.redis.database=3
|
||||
spring.redis.host=10.251.129.122
|
||||
spring.redis.password=qwert!W588
|
||||
spring.redis.database=1
|
||||
spring.redis.host=10.251.160.38
|
||||
spring.redis.password=qwert!W577
|
||||
spring.redis.port=6379
|
||||
|
||||
# cloud nacos config
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.181.11:8848
|
||||
|
||||
## datasource config
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
@@ -54,4 +57,4 @@ xboe.elasticsearch.server.password=
|
||||
xboe.email.url=https://u.boe.com/api/b1/email/send
|
||||
xboe.email.from=boeu_learning@boe.com.cn
|
||||
xboe.email.user=
|
||||
xboe.email.security=
|
||||
xboe.email.security=
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
|
||||
|
||||
|
||||
# cloud nacos config
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.181.11:8848
|
||||
|
||||
## redis
|
||||
spring.redis.database=3
|
||||
spring.redis.database=1
|
||||
spring.redis.host=10.251.129.122
|
||||
spring.redis.password=qwert!W588
|
||||
spring.redis.port=6379
|
||||
@@ -73,4 +75,4 @@ xboe.elasticsearch.server.password=
|
||||
xboe.email.url=https://u.boe.com/api/b1/email/send
|
||||
xboe.email.from=boeu_learning@boe.com.cn
|
||||
xboe.email.user=
|
||||
xboe.email.security=
|
||||
xboe.email.security=
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
## redis
|
||||
spring.redis.database=2
|
||||
spring.redis.database=1
|
||||
spring.redis.host=10.251.160.38
|
||||
spring.redis.password=qwert!W577
|
||||
spring.redis.port=6379
|
||||
|
||||
# cloud nacos config
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.186.27:8848
|
||||
|
||||
## datasource config
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
|
||||
Reference in New Issue
Block a user