Commit 875dd83c authored by 李博今's avatar 李博今

Merge branch 'V2.0.3' of http://103.249.252.28:90/lcy/education

parents fb427873 8641a120
...@@ -47,7 +47,8 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -47,7 +47,8 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
" bf.video_url AS videoUrl,\n" + " bf.video_url AS videoUrl,\n" +
" bf.file_url AS fileUrl,\n" + " bf.file_url AS fileUrl,\n" +
" bf.ppt_url AS pptUrl,\n" + " bf.ppt_url AS pptUrl,\n" +
" bf.pdf_url AS pdfUrl,\n" + " bf.pdf_url AS pdfUrl," +
" bf.video_name AS fileName,\n" +
" pc.business_id AS paperUrl," + " pc.business_id AS paperUrl," +
" (SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum \n" + " (SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum \n" +
" FROM\n" + " FROM\n" +
......
...@@ -136,6 +136,9 @@ public class BChapter extends IdEntity<BChapter> { ...@@ -136,6 +136,9 @@ public class BChapter extends IdEntity<BChapter> {
@Transient @Transient
private String paperUrl; private String paperUrl;
@Transient
private String fileName;
public BChapter(String businessId) { public BChapter(String businessId) {
this.businessId = businessId; this.businessId = businessId;
......
...@@ -153,8 +153,8 @@ public class BClassController extends PaginationController<BClass> { ...@@ -153,8 +153,8 @@ public class BClassController extends PaginationController<BClass> {
@ApiOperation(value="查询班级列表", notes="查询班级列表赋值在下拉框中") @ApiOperation(value="查询班级列表", notes="查询班级列表赋值在下拉框中")
@GetMapping(value = "/queryBClassList") @GetMapping(value = "/queryBClassList")
public Result queryBClassList() { public Result queryBClassList(String type) {
List<SelectModel> bClass = bClassService.queryBClassList(); List<SelectModel> bClass = bClassService.queryBClassList(type);
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
......
package org.rcisoft.business.bclass.dao; package org.rcisoft.business.bclass.dao;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.bclass.entity.BClass; import org.rcisoft.business.bclass.entity.BClass;
...@@ -50,9 +51,10 @@ public interface BClassRepository extends BaseMapper<BClass> { ...@@ -50,9 +51,10 @@ public interface BClassRepository extends BaseMapper<BClass> {
"</foreach></script>") "</foreach></script>")
int insertBusinessClassList(List<BClass> bClasses); int insertBusinessClassList(List<BClass> bClasses);
@Select("select * from b_class where del_flag != 1 and flag = 1") @Select("<script>select * from b_class where del_flag != 1 and flag = 1 " +
"<if test=\"type!=null and type!=''\">and type = #{type}</if></script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BClass> queryBClassList(); List<BClass> queryBClassList(@Param("type") String type);
@Select("select class_name from b_class where find_in_set(code,#{classesCode}) and del_flag != 1 and flag = 1") @Select("select class_name from b_class where find_in_set(code,#{classesCode}) and del_flag != 1 and flag = 1")
List<String> queryClassNamesByIds(String classesCode); List<String> queryClassNamesByIds(String classesCode);
......
...@@ -75,5 +75,5 @@ public interface BClassService{ ...@@ -75,5 +75,5 @@ public interface BClassService{
*/ */
PersistModel businessImportExcel(HSSFWorkbook hwb, String token) throws IOException; PersistModel businessImportExcel(HSSFWorkbook hwb, String token) throws IOException;
List<SelectModel> queryBClassList(); List<SelectModel> queryBClassList(String type);
} }
...@@ -272,8 +272,8 @@ public class BClassServiceImpl implements BClassService { ...@@ -272,8 +272,8 @@ public class BClassServiceImpl implements BClassService {
} }
@Override @Override
public List<SelectModel> queryBClassList() { public List<SelectModel> queryBClassList(String type) {
List<BClass> bClass = bClassRepository.queryBClassList(); List<BClass> bClass = bClassRepository.queryBClassList(type);
ArrayList<SelectModel> comBoxModel = new ArrayList<SelectModel>(); ArrayList<SelectModel> comBoxModel = new ArrayList<SelectModel>();
for(BClass c : bClass){ for(BClass c : bClass){
SelectModel selectModel = new SelectModel(); SelectModel selectModel = new SelectModel();
......
...@@ -156,48 +156,41 @@ public class BFileController extends PaginationController<BFile> { ...@@ -156,48 +156,41 @@ public class BFileController extends PaginationController<BFile> {
*/ */
@ApiOperation(value="下载文件", notes="下载文件") @ApiOperation(value="下载文件", notes="下载文件")
@ApiImplicitParam(name = "chapterId", value = "章节ID", required = true, dataType = "varchar") @ApiImplicitParam(name = "chapterId", value = "章节ID", required = true, dataType = "varchar")
@PostMapping(value = "/downloadFile") @GetMapping(value = "/downloadFileWithoutAuth")
public Result downloadFile(String chapterId, HttpServletResponse response){ public Result downloadFileWithoutAuth(String chapterId, HttpServletResponse response) throws IOException {
BFile video = bFileService.queryFileUrlByChapterId(chapterId); BFile bFile = bFileService.queryFileUrlByChapterId(chapterId);
BufferedInputStream bis = null; BufferedInputStream bis = null;
BufferedOutputStream bos = null; BufferedOutputStream bos = null;
if(video.getVideoUrl()!=""&&video.getVideoUrl()!=null){ if(bFile.getFileUrl()!=""&&bFile.getFileUrl()!=null){
try { File file=new File(global.getBASE_UPLOAD_SERVER_LOCATION()+File.separator+bFile.getFileUrl());
File file=new File(global.getBASE_UPLOAD_SERVER_LOCATION()+video.getVideoUrl()); if(!file.isFile()){
bis = new BufferedInputStream(new FileInputStream(file)); throw new ServiceException(ResultServiceEnums.DOWNLOAD_ERROR);
bos = new BufferedOutputStream(response.getOutputStream());
response.reset();
response.setContentType("application/octet-stream;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename="+ new String((video.getVideoName()).getBytes(), "iso-8859-1"));
response.setHeader("Access-Control-Allow-Origin", "*");
IOUtils.copy(bis, bos);
}catch (Exception e){
e.printStackTrace();
}finally {
if (bis != null)
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
}
if (bos != null)
try {
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
return Result.builder(new PersistModel(1), bis = new BufferedInputStream(new FileInputStream(file));
MessageConstant.MESSAGE_ALERT_SUCCESS, bos = new BufferedOutputStream(response.getOutputStream());
MessageConstant.MESSAGE_ALERT_ERROR,
""); String fileName = "";
}else{ if(bFile.getVideoName()!=null&&!bFile.getVideoName().equals("")&&bFile.getVideoName().endsWith(".zip")){
return Result.builder(new PersistModel(0), fileName = bFile.getVideoName();
MessageConstant.MESSAGE_ALERT_SUCCESS, }else{
MessageConstant.MESSAGE_ALERT_ERROR, fileName = file.getName();
""); }
response.reset();
response.setContentType("application/octet-stream;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename="+ new String((fileName).getBytes(), "iso-8859-1"));
response.setHeader("Access-Control-Allow-Origin", "*");
IOUtils.copy(bis, bos);
bis.close();
bos.close();
}else {
throw new ServiceException(ResultServiceEnums.DOWNLOAD_ERROR);
} }
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
"");
} }
} }
...@@ -267,7 +267,10 @@ public class BFileServiceImpl implements BFileService { ...@@ -267,7 +267,10 @@ public class BFileServiceImpl implements BFileService {
e.printStackTrace(); e.printStackTrace();
} }
} }
bFile.setVideoName(name+ "." +uploadFileSuffix);//文件名 //上传的是文件时才存文件名,方便下载时取
if(bFile.getType().equals("1")){
bFile.setVideoName(name+ "." +uploadFileSuffix);//文件名
}
if (bFile.getType().equals("0")){ if (bFile.getType().equals("0")){
......
...@@ -197,7 +197,7 @@ public class BSlServiceImpl implements BSlService { ...@@ -197,7 +197,7 @@ public class BSlServiceImpl implements BSlService {
lessonCode.add(value[1]); lessonCode.add(value[1]);
continue; continue;
} }
if ((bTermRepository.selectOne(new BTerm(value[3]))) == null) { if ((bTermRepository.selectOne(new BTerm(value[3],null))) == null) {
if (!termCode.contains(value[3])) if (!termCode.contains(value[3]))
termCode.add(value[3]); termCode.add(value[3]);
continue; continue;
......
...@@ -80,7 +80,7 @@ public class BSlApplyServiceImpl implements BSlApplyService { ...@@ -80,7 +80,7 @@ public class BSlApplyServiceImpl implements BSlApplyService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel persist(BSlApply model, String token){ public PersistModel persist(BSlApply model, String token){
int line = 0; int line = 0;
if(model.getTermCode()!=null&&bTermRepository.selectOne(new BTerm(model.getTermCode()))==null) if(model.getTermCode()!=null&&bTermRepository.selectOne(new BTerm(model.getTermCode(),null))==null)
throw new ServiceException(ResultServiceEnums.TERM_NOT_EXISTS); throw new ServiceException(ResultServiceEnums.TERM_NOT_EXISTS);
if(model.getTeacherCode()!=null&&bTeacherRepository.selectOne(new BTeacher(model.getTeacherCode()))==null) if(model.getTeacherCode()!=null&&bTeacherRepository.selectOne(new BTeacher(model.getTeacherCode()))==null)
throw new ServiceException(ResultServiceEnums.TEACHER_NOT_EXISTS); throw new ServiceException(ResultServiceEnums.TEACHER_NOT_EXISTS);
......
...@@ -140,9 +140,9 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -140,9 +140,9 @@ public class BStudentServiceImpl implements BStudentService {
List<String> valuesEmailExist = new ArrayList<>(); List<String> valuesEmailExist = new ArrayList<>();
List<String> valuesGrade = new ArrayList<>(); List<String> valuesGrade = new ArrayList<>();
int i = 1; int i = 0;
for (String[] value : values) { for (String[] value : values) {
i++;
String stuCode = value[0]; String stuCode = value[0];
//判断1:学号是否满足8~15位; //判断1:学号是否满足8~15位;
...@@ -225,7 +225,6 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -225,7 +225,6 @@ public class BStudentServiceImpl implements BStudentService {
users.add(user); users.add(user);
userRoles.add(userRole); userRoles.add(userRole);
} }
i++;
} }
......
...@@ -94,9 +94,9 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -94,9 +94,9 @@ public class BTeacherServiceImpl implements BTeacherService {
List<String> valuesShort = new ArrayList<>(); List<String> valuesShort = new ArrayList<>();
List<String> valuesIncomplete = new ArrayList<>(); List<String> valuesIncomplete = new ArrayList<>();
List<String> valuesAgencyExist = new ArrayList<>(); List<String> valuesAgencyExist = new ArrayList<>();
int i = 1; int i = 0;
for (String[] value : values) { for (String[] value : values) {
i++;
String teaCode = value[0]; String teaCode = value[0];
//判断1:学号是否满足8~15位; //判断1:学号是否满足8~15位;
...@@ -177,7 +177,6 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -177,7 +177,6 @@ public class BTeacherServiceImpl implements BTeacherService {
users.add(user); users.add(user);
userRoles.add(userRole); userRoles.add(userRole);
} }
i++;
} }
String result = ""; String result = "";
if (teachers.size()>0){ if (teachers.size()>0){
......
...@@ -144,15 +144,15 @@ public class BTermController extends PaginationController<BTerm> { ...@@ -144,15 +144,15 @@ public class BTermController extends PaginationController<BTerm> {
@ApiOperation(value="更改当前学期", notes="更改当前学期") @ApiOperation(value="更改当前学期", notes="更改当前学期")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar") @ApiImplicitParam(name = "code", value = "code", required = true, dataType = "varchar")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "/changeCurrent") @PostMapping(value = "/changeCurrent")
public Result changeCurrent(@RequestParam("id") String id){ public Result changeCurrent(@RequestParam("code") String code){
PersistModel data=bTermService.changeCurrent(id); PersistModel data=bTermService.changeCurrent(code);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
id); code);
} }
@ApiOperation(value="获取校历", notes="获取校历") @ApiOperation(value="获取校历", notes="获取校历")
......
...@@ -46,8 +46,8 @@ public interface BTermRepository extends BaseMapper<BTerm> { ...@@ -46,8 +46,8 @@ public interface BTermRepository extends BaseMapper<BTerm> {
@Update("<script>update b_term set current = '0'</script>") @Update("<script>update b_term set current = '0'</script>")
int changeAllTermNotCurrent(); int changeAllTermNotCurrent();
@Update("<script>update b_term set current = '1' where business_id = #{id}</script>") @Update("<script>update b_term set current = '1' where code = #{code} and del_flag = 0 and flag = 1</script>")
int changeCurrent(String id); int changeCurrent(String code);
@Select("select max_sl_code from b_term where code = #{termCode}") @Select("select max_sl_code from b_term where code = #{termCode}")
int queryMaxSlCodeByTermCode(String termCode); int queryMaxSlCodeByTermCode(String termCode);
...@@ -69,5 +69,13 @@ public interface BTermRepository extends BaseMapper<BTerm> { ...@@ -69,5 +69,13 @@ public interface BTermRepository extends BaseMapper<BTerm> {
@Select("select * from b_term where code = #{termCode}") @Select("select * from b_term where code = #{termCode}")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
BTerm queryCurrentTerm(String termCode); BTerm queryCurrentTerm(String termCode);
@Select("select * from b_term " +
"WHERE (#{startDate} BETWEEN start_date AND end_date) " +
"OR (#{endDate} BETWEEN start_date AND end_date) " +
"OR (start_date BETWEEN #{startDate} AND #{endDate}) " +
"OR (end_date BETWEEN #{startDate} AND #{endDate})")
@ResultMap(value = "BaseResultMap" )
List<BTerm> queryBTermsByStartDateOrEndDate(BTerm model);
} }
...@@ -24,8 +24,9 @@ public class BTerm extends IdEntity<BTerm> { ...@@ -24,8 +24,9 @@ public class BTerm extends IdEntity<BTerm> {
private static final long serialVersionUID = 6619306545135522432L; private static final long serialVersionUID = 6619306545135522432L;
public BTerm(String code) { public BTerm(String code, String name) {
this.code = code; this.code = code;
this.name = name;
} }
......
...@@ -58,7 +58,7 @@ public interface BTermService{ ...@@ -58,7 +58,7 @@ public interface BTermService{
List<SelectModel> queryBTermList(); List<SelectModel> queryBTermList();
PersistModel changeCurrent(String id); PersistModel changeCurrent(String code);
Map<String,Object> getSchoolWeek(String termCode); Map<String,Object> getSchoolWeek(String termCode);
} }
...@@ -56,13 +56,22 @@ public class BTermServiceImpl implements BTermService { ...@@ -56,13 +56,22 @@ public class BTermServiceImpl implements BTermService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel persist(BTerm model, String token){ public PersistModel persist(BTerm model, String token){
//验证时间区间是否重叠
List<BTerm> bTerms = bTermRepository.queryBTermsByStartDateOrEndDate(model);
if(bTerms.size()>0){
throw new ServiceException(ResultServiceEnums.CAN_NOT_OVERLAP);
}
//验证名称是否重复
if(bTermRepository.selectOne(new BTerm(null,model.getName()))!=null)
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
int line = 0; int line = 0;
model.setWeek(String.valueOf(Week.buildList(model.getStartDate(),model.getEndDate()).size() + 1)); model.setWeek(String.valueOf(Week.buildList(model.getStartDate(),model.getEndDate()).size() + 1));
if(model.getBusinessId()!=null) { if(model.getBusinessId()!=null) {
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
line = bTermRepository.updateByPrimaryKeySelective(model); line = bTermRepository.updateByPrimaryKeySelective(model);
}else { }else {
if(bTermRepository.selectOne(new BTerm(model.getCode()))!=null) //验证编号是否重复
if(bTermRepository.selectOne(new BTerm(model.getCode(),null))!=null)
throw new ServiceException(ResultServiceEnums.TERM_EXISTS); throw new ServiceException(ResultServiceEnums.TERM_EXISTS);
Map<String,Object> map = Week.buildWeek(model.getStartDate(),model.getEndDate()); Map<String,Object> map = Week.buildWeek(model.getStartDate(),model.getEndDate());
model.setWeek(String.valueOf(((List<Week>) map.get("weeks")).size())); model.setWeek(String.valueOf(((List<Week>) map.get("weeks")).size()));
...@@ -133,11 +142,11 @@ public class BTermServiceImpl implements BTermService { ...@@ -133,11 +142,11 @@ public class BTermServiceImpl implements BTermService {
} }
@Override @Override
public PersistModel changeCurrent(String id) { public PersistModel changeCurrent(String code) {
//先把学期全部置为否 //先把学期全部置为否
bTermRepository.changeAllTermNotCurrent(); bTermRepository.changeAllTermNotCurrent();
//把所选的学期置为是 //把所选的学期置为是
int result = bTermRepository.changeCurrent(id); int result = bTermRepository.changeCurrent(code);
return new PersistModel(result); return new PersistModel(result);
} }
......
...@@ -15,6 +15,7 @@ import org.springframework.http.converter.HttpMessageConverter; ...@@ -15,6 +15,7 @@ import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.HandlerExceptionResolver;
...@@ -80,7 +81,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter { ...@@ -80,7 +81,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
if (handler instanceof HandlerMethod) { if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler; HandlerMethod handlerMethod = (HandlerMethod) handler;
if(e instanceof SystemException){ if(e instanceof SystemException){
/*sys*/ /*license*/
try { try {
throw e; throw e;
} catch (Exception e1) { } catch (Exception e1) {
...@@ -88,14 +89,16 @@ public class MvcConfig extends WebMvcConfigurerAdapter { ...@@ -88,14 +89,16 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
log.error(e1.getMessage()); log.error(e1.getMessage());
} }
} }
if (e instanceof ServiceException) {//业务失败的异常,如“账号或密码错误” if (e instanceof ServiceException) {//业务失败的异常,如“账号或密码错误”
result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); result.setCode(ResultCode.FAIL).setMessage(e.getMessage());
} else if (e instanceof AuthenticationException) { } else if (e instanceof AuthenticationException) {
if (e instanceof BadCredentialsException) if (e instanceof BadCredentialsException) {
//密码错误 //密码错误
result.setCode(ResultCode.UNAUTHORIZED).setMessage(e.getMessage()); result.setCode(ResultCode.UNAUTHORIZED).setMessage(e.getMessage());
} else if (e instanceof DisabledException){
//用户已停用
result.setCode(ResultCode.UNAUTHORIZED).setMessage("用户已停用");
}
else else
result.setCode(ResultCode.UNAUTHORIZED).setMessage(e.getMessage()); result.setCode(ResultCode.UNAUTHORIZED).setMessage(e.getMessage());
} else if (e instanceof AccessDeniedException) { } else if (e instanceof AccessDeniedException) {
......
...@@ -20,6 +20,9 @@ public class JwtUser implements UserDetails{ ...@@ -20,6 +20,9 @@ public class JwtUser implements UserDetails{
private final String username; private final String username;
private final String password; private final String password;
private boolean enable = true;
/** 权限类.*/ /** 权限类.*/
private final Collection<? extends GrantedAuthority> authorities; private final Collection<? extends GrantedAuthority> authorities;
...@@ -68,6 +71,6 @@ public class JwtUser implements UserDetails{ ...@@ -68,6 +71,6 @@ public class JwtUser implements UserDetails{
} }
@JsonIgnore @JsonIgnore
public boolean isEnabled() { public boolean isEnabled() {
return true; return enable;
} }
} }
...@@ -187,6 +187,8 @@ public enum ResultServiceEnums { ...@@ -187,6 +187,8 @@ public enum ResultServiceEnums {
NAME_IS_EXISTS(99,"名称重复"), NAME_IS_EXISTS(99,"名称重复"),
DATA_HAS_USED(100,"当前数据被使用,不可删除"), DATA_HAS_USED(100,"当前数据被使用,不可删除"),
CAN_NOT_OVERLAP(101,"时间区间不可重叠"),
; ;
private Integer code; private Integer code;
......
...@@ -52,14 +52,14 @@ public class JwtAuthenTokenFilter extends OncePerRequestFilter { ...@@ -52,14 +52,14 @@ public class JwtAuthenTokenFilter extends OncePerRequestFilter {
/**/ /**/
String lk = rcRedisServiceImpl.get("lk"); String lk = rcRedisServiceImpl.get("lk");
// if(StringUtils.isBlank(lk) || !"1".equals(lk)){ if(StringUtils.isBlank(lk) || !"1".equals(lk)){
// if(permitRes==-1) { if(permitRes==-1) {
// Result result = new Result(); Result result = new Result();
// result.setCode(202); result.setCode(202);
// ResponseUtil.responseResult(response, result); ResponseUtil.responseResult(response, result);
// return; return;
// } }
// } }
// 取得header // 取得header
String authHeader = request.getHeader(this.tokenHeader); String authHeader = request.getHeader(this.tokenHeader);
//判断header头 //判断header头
......
package org.rcisoft.core.service.impl; package org.rcisoft.core.service.impl;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.rcisoft.core.constant.FlagStatus;
import org.rcisoft.core.model.JwtUser;
import org.rcisoft.core.util.JwtUserFactory; import org.rcisoft.core.util.JwtUserFactory;
import org.rcisoft.sys.role.dao.SysRoleRepository; import org.rcisoft.sys.role.dao.SysRoleRepository;
import org.rcisoft.sys.role.entity.SysRole; import org.rcisoft.sys.role.entity.SysRole;
...@@ -41,6 +43,10 @@ public class JwtUserDetailServiceImpl implements UserDetailsService { ...@@ -41,6 +43,10 @@ public class JwtUserDetailServiceImpl implements UserDetailsService {
if (CollectionUtils.isEmpty(roles)) if (CollectionUtils.isEmpty(roles))
roles = Collections.emptyList(); roles = Collections.emptyList();
sysUser.setRoleList(roles); sysUser.setRoleList(roles);
return JwtUserFactory.create(sysUser); JwtUser user = JwtUserFactory.create(sysUser);
/*停用*/
if(FlagStatus.ABNORMAL.getStatus().equals(sysUser.getFlag()))
user.setEnable(false);
return user;
} }
} }
...@@ -19,7 +19,7 @@ import java.util.List; ...@@ -19,7 +19,7 @@ import java.util.List;
public interface SysUserMapper extends BaseMapper<SysUser> { public interface SysUserMapper extends BaseMapper<SysUser> {
@Select("<script>select * from s_user where login_name = #{username} and del_flag = 0 and flag = 1</script>") @Select("<script>select * from s_user where login_name = #{username} and del_flag = 0 </script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<SysUser> queryUserByName(String username); List<SysUser> queryUserByName(String username);
...@@ -42,7 +42,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -42,7 +42,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"(#{businessId},#{userId},#{roleId})") "(#{businessId},#{userId},#{roleId})")
int insertUserRole(UserRole userRole); int insertUserRole(UserRole userRole);
@Select("SELECT u.business_id from s_user u left join ${tab} s on u.login_name = s.code where s.business_id = #{id} and u.del_flag = 0 and u.flag = 1") @Select("SELECT u.business_id from s_user u left join ${tab} s on u.login_name = s.code where s.business_id = #{id} and u.del_flag = 0")
String selectUserIdByStuOrTeaId(@Param("id") String id, @Param("tab") String table); String selectUserIdByStuOrTeaId(@Param("id") String id, @Param("tab") String table);
@Update("update s_user set del_flag = 1 where login_name = #{code}") @Update("update s_user set del_flag = 1 where login_name = #{code}")
...@@ -74,7 +74,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -74,7 +74,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Update("<script>update s_user set password = #{password} where 1=1 " + @Update("<script>update s_user set password = #{password} where 1=1 " +
"and login_name = #{loginName} " + "and login_name = #{loginName} " +
"and del_flag = 0 and flag = 1</script>") "and del_flag = 0</script>")
int resetPassword(@Param("loginName") String loginNam,@Param("password") String password); int resetPassword(@Param("loginName") String loginNam,@Param("password") String password);
@Select("<script>select business_id from s_user where login_name = #{studentCode} and del_flag = 0 and flag = 1</script>") @Select("<script>select business_id from s_user where login_name = #{studentCode} and del_flag = 0 and flag = 1</script>")
......
spring: spring:
profiles: profiles:
active: dev active: dev
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment