|
@@ -7,7 +7,6 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
-import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
@@ -25,20 +24,18 @@ import com.ssj.api.domain.vo.train.TrainVideoFileVo;
|
|
|
import com.ssj.api.domain.vo.train.TrainVideoVo;
|
|
|
import com.ssj.api.security.annotation.IgnoreSecurity;
|
|
|
import com.ssj.bean.sys.train.bean.ExamInfo;
|
|
|
+import com.ssj.bean.sys.train.bean.TrainUser;
|
|
|
import com.ssj.bean.sys.train.bean.VideoInfo;
|
|
|
import com.ssj.bean.sys.train.bean.VideoUser;
|
|
|
-import com.ssj.bean.weixin.libmy.domain.TbLibManager;
|
|
|
-import com.ssj.bean.weixin.user.domain.User;
|
|
|
import com.ssj.framework.core.common.controller.BaseController;
|
|
|
import com.ssj.framework.core.util.CodecUtil;
|
|
|
import com.ssj.framework.core.util.ResponseConstant;
|
|
|
import com.ssj.framework.core.util.ResponseEntity;
|
|
|
import com.ssj.service.sys.train.service.ExamInfoService;
|
|
|
+import com.ssj.service.sys.train.service.TrainUserService;
|
|
|
import com.ssj.service.sys.train.service.VideoFileService;
|
|
|
import com.ssj.service.sys.train.service.VideoInfoService;
|
|
|
import com.ssj.service.sys.train.service.VideoUserService;
|
|
|
-import com.ssj.service.weixin.library.service.IBookManagerService;
|
|
|
-import com.ssj.service.weixin.user.service.UserService;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -54,12 +51,6 @@ import io.swagger.annotations.ApiOperation;
|
|
|
public class ApiTrainController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
- private UserService userService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IBookManagerService bookManagerService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private VideoUserService videoUserService;
|
|
|
|
|
|
@Autowired
|
|
@@ -71,6 +62,9 @@ public class ApiTrainController extends BaseController {
|
|
|
@Autowired
|
|
|
private ExamInfoService examInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TrainUserService trainUserService;
|
|
|
+
|
|
|
|
|
|
private static List<RoleTypeModel> defaultRoleTypeModels=new ArrayList<RoleTypeModel>();
|
|
|
private static List<String> defaultRoleTypeNames=new ArrayList<String>();
|
|
@@ -116,24 +110,6 @@ public class ApiTrainController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //查询出校长,老师的身份
|
|
|
- private TbLibManager getTbLibManagerUserId(String userId) {
|
|
|
- List<TbLibManager> teacherLists = bookManagerService.findAllManagerByTeacherId(userId);
|
|
|
- if(CollectionUtils.isEmpty(teacherLists)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- TbLibManager tbLibManager=teacherLists.get(0);
|
|
|
- for (TbLibManager libManager : teacherLists) {
|
|
|
- //有校长身份的,优先显示校长身份的数据
|
|
|
- if(libManager.getType()==6) {
|
|
|
- tbLibManager=libManager;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return tbLibManager;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private Map<String, Object> getTrainVideoUserMap(Integer roleType,List<Map<String,Object>> list){
|
|
|
for (Map<String, Object> map : list) {
|
|
|
if(roleType==(int)map.get("role_type")) {
|
|
@@ -152,28 +128,21 @@ public class ApiTrainController extends BaseController {
|
|
|
ResponseEntity responseEntity = new ResponseEntity();
|
|
|
Map<String, Object> data=new HashMap<String, Object>();
|
|
|
try {
|
|
|
- User phoneUser = userService.findByMobile(requestVO.getLoginName());
|
|
|
+ TrainUser phoneUser = trainUserService.getTrainUserByMobile(requestVO.getLoginName());
|
|
|
if (phoneUser == null) {
|
|
|
responseEntity.failure(ResponseConstant.CODE_000, "账号无效");
|
|
|
return responseEntity;
|
|
|
}
|
|
|
- User user = userService.getUserByPassword(requestVO.getLoginName(), requestVO.getPassword());
|
|
|
+ TrainUser user = trainUserService.login(requestVO.getLoginName(), requestVO.getPassword());
|
|
|
if (user == null) {
|
|
|
responseEntity.failure("密码错误");
|
|
|
return responseEntity;
|
|
|
}
|
|
|
- //查询该老师拥有的角色
|
|
|
- TbLibManager tbLibManager = getTbLibManagerUserId(user.getId());
|
|
|
- if(tbLibManager==null) {
|
|
|
- responseEntity.failure("账号无身份权限");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
|
|
|
data.put("userId", user.getId());
|
|
|
- data.put("name", StringUtils.isNotEmpty(tbLibManager.getName())? tbLibManager.getName(): "");
|
|
|
+ data.put("name", StringUtils.isNotEmpty(user.getName())? user.getName(): "");
|
|
|
data.put("photo", StringUtils.isNotEmpty(user.getPhoto())? user.getPhoto(): "");
|
|
|
data.put("accessToken", getAccessToken(user.getId(),CodecUtil.createUUID()));
|
|
|
- //data.put("roleTypes", defaultRoleTypeModels);
|
|
|
responseEntity.success(data, "账号密码登录成功");
|
|
|
} catch (Exception e) {
|
|
|
logger.error("账号密码登录接口", e);
|
|
@@ -191,14 +160,14 @@ public class ApiTrainController extends BaseController {
|
|
|
Map<String, Object> data=new HashMap<String, Object>();
|
|
|
try {
|
|
|
String userId = tokenManager.getUserId(accessToken);
|
|
|
- TbLibManager tbLibManager = getTbLibManagerUserId(userId);
|
|
|
+ TrainUser tbLibManager = trainUserService.getById(userId);
|
|
|
if(tbLibManager==null) {
|
|
|
responseEntity.failure("账号无身份权限");
|
|
|
return responseEntity;
|
|
|
}
|
|
|
List<Map<String,Object>> list=videoUserService.findTrainVideoUserByUserId(userId);
|
|
|
//是校长
|
|
|
- if(tbLibManager.getType()==6) {
|
|
|
+ if(tbLibManager.getRoleType()==1) {
|
|
|
defaultRoleTypeModels.get(0).setUnlock(1);
|
|
|
|
|
|
Map<String, Object> dataMap1=getTrainVideoUserMap(1, list);
|
|
@@ -247,7 +216,7 @@ public class ApiTrainController extends BaseController {
|
|
|
List<Map<String, Object>> data=new ArrayList<Map<String,Object>>();
|
|
|
try {
|
|
|
String userId = tokenManager.getUserId(accessToken);
|
|
|
- TbLibManager tbLibManager = getTbLibManagerUserId(userId);
|
|
|
+ TrainUser tbLibManager = trainUserService.getById(userId);
|
|
|
if(tbLibManager==null) {
|
|
|
responseEntity.failure("账号无身份权限");
|
|
|
return responseEntity;
|
|
@@ -259,7 +228,7 @@ public class ApiTrainController extends BaseController {
|
|
|
map1.put("roleType", 1);
|
|
|
map1.put("roleName", defaultRoleTypeNames.get(0));
|
|
|
//校长才显示校长端
|
|
|
- if(tbLibManager.getType()==6) {
|
|
|
+ if(tbLibManager.getRoleType()==1) {
|
|
|
map1.put("successNum", dataMap1!=null ? Integer.parseInt(dataMap1.get("success_num").toString()):0);
|
|
|
map1.put("countNum", dataMap1!=null ? Integer.parseInt(dataMap1.get("count_num").toString()):0);
|
|
|
map1.put("unlock", 1);
|