Compare commits
19 Commits
06c3be33e2
...
5075426bcf
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5075426bcf | ||
fb9820be31 | |||
![]() |
0de184db59 | ||
3bde291f0f | |||
![]() |
e0df2dcc4e | ||
![]() |
df52d05759 | ||
![]() |
820a46c9ef | ||
63667c527f | |||
1b7c65e817 | |||
01173e9cfc | |||
![]() |
acd699e912 | ||
![]() |
eb5095f4a8 | ||
860b109ebf | |||
65c06e8eef | |||
96fdab94f7 | |||
88ed6e0ca9 | |||
3b0aee6db4 | |||
264ac569b6 | |||
f0fcfba065 |
@ -76,7 +76,8 @@ public class AuthControllerAspect {
|
||||
"&& !execution(* com.jsl.oa.controllers.CustomController.*(..)) " +
|
||||
"&& !execution(* com.jsl.oa.controllers.InfoController.infoGetHeaderImage(..)) " +
|
||||
"&& !execution(* com.jsl.oa.controllers.InfoController.infoGetHeaderUser(..))" +
|
||||
"&& !execution(* com.jsl.oa.controllers.ProjectController.projectGetCustom(..))")
|
||||
"&& !execution(* com.jsl.oa.controllers.ProjectController.*(..))" +
|
||||
"&& !execution(* com.jsl.oa.controllers.TagController.*(..))")
|
||||
public Object tokenControllerAround(ProceedingJoinPoint pjp) throws Throwable {
|
||||
// 获取 HttpServletRequest 对象
|
||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
|
@ -64,8 +64,11 @@ public class ShiroConfiguration {
|
||||
filterChainDefinitionMap.put("/project/header/get", "anon"); // 信息接口允许匿名访问
|
||||
filterChainDefinitionMap.put("/project/get", "anon"); // 信息接口允许匿名访问
|
||||
filterChainDefinitionMap.put("/project/get/custom", "anon"); // 游客获取项目允许匿名访问
|
||||
filterChainDefinitionMap.put("/project/add", "anon"); // 信息接口允许匿名访问
|
||||
filterChainDefinitionMap.put("/tags/project/list", "anon"); // 信息接口允许匿名访问
|
||||
filterChainDefinitionMap.put("/**/**", "authc"); // 其他接口一律拦截(需要Token)
|
||||
|
||||
|
||||
return filterChainDefinitionMap;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class InfoDAO {
|
||||
log.info("\t\t> 从 MySQL 获取数据");
|
||||
String getCarouselSql = infoMapper.getCarousel();
|
||||
CarouselDO getCarousel = null;
|
||||
if (getCarouselSql != null && !getCarouselSql.equals("{}")) {
|
||||
if (getCarouselSql != null && !"{}".equals(getCarouselSql)) {
|
||||
getCarousel = gson.fromJson(getCarouselSql, CarouselDO.class);
|
||||
}
|
||||
if (getCarousel == null) {
|
||||
@ -54,13 +54,17 @@ public class InfoDAO {
|
||||
}
|
||||
// 获取排序
|
||||
sortCarousel(getCarousel);
|
||||
// 添加id
|
||||
for (int i = 0; i < getCarousel.getData().size(); i++) {
|
||||
getCarousel.getData().get(i).setId(i + 1);
|
||||
}
|
||||
return getCarousel;
|
||||
}
|
||||
|
||||
private void sortCarousel(CarouselDO getCarousel) {
|
||||
for (int i = 0; i < getCarousel.getData().size(); i++) {
|
||||
for (int j = 0; j < getCarousel.getData().size(); j++) {
|
||||
if (getCarousel.getOrder().equals("desc")) {
|
||||
if ("desc".equals(getCarousel.getOrder())) {
|
||||
if (getCarousel.getData().get(i).getDisplayOrder() > getCarousel.getData().get(j).getDisplayOrder()) {
|
||||
Collections.swap(getCarousel.getData(), i, j);
|
||||
}
|
||||
@ -84,6 +88,10 @@ public class InfoDAO {
|
||||
public boolean setCarousel(CarouselDO carouselDO) {
|
||||
log.info("\t> 执行 DAO 层 InfoDAO.setCarousel 方法");
|
||||
sortCarousel(carouselDO);
|
||||
// 添加id
|
||||
for (int i = 0; i < carouselDO.getData().size(); i++) {
|
||||
carouselDO.getData().get(i).setId(i + 1);
|
||||
}
|
||||
String setCarouselSql = gson.toJson(carouselDO);
|
||||
log.info("\t\t> 从 MySQL 获取数据");
|
||||
return infoMapper.setCarousel(setCarouselSql);
|
||||
|
@ -128,12 +128,16 @@ public class ProjectDAO {
|
||||
public List<ProjectDO> get(Long userId,Integer listAll,List<String> tags,List<Integer> isFinish) {
|
||||
log.info("\t> 执行 DAO 层 ProjectDAO.get 方法");
|
||||
log.info("\t\t> 从 MySQL 获取数据");
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
log.info("tags");
|
||||
return projectMapper.getByTags(userId,tags,isFinish);
|
||||
}
|
||||
|
||||
if(isFinish != null && !isFinish.isEmpty()){
|
||||
log.info("finish");
|
||||
return projectMapper.getByIsfinish(userId,isFinish);
|
||||
}
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.getByTags(userId,tags);
|
||||
}
|
||||
|
||||
if(listAll == 0) {
|
||||
return projectMapper.get(userId);
|
||||
}else {
|
||||
@ -144,12 +148,14 @@ public class ProjectDAO {
|
||||
public List<ProjectDO> workget(Long userId, Integer listAll, List<String> tags, List<Integer> isFinish, Integer is) {
|
||||
log.info("\t> 执行 DAO 层 ProjectDAO.workget 方法");
|
||||
log.info("\t\t> 从 MySQL 获取数据");
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.workgetByTags(userId,tags,is,isFinish);
|
||||
}
|
||||
|
||||
if(isFinish != null && !isFinish.isEmpty()){
|
||||
return projectMapper.workgetByIsfinish(userId,isFinish,is);
|
||||
}
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.workgetByTags(userId,tags,is);
|
||||
}
|
||||
|
||||
if(listAll == 0) {
|
||||
return projectMapper.workget(userId,is);
|
||||
}else {
|
||||
@ -220,12 +226,14 @@ public class ProjectDAO {
|
||||
|
||||
public List<ProjectDO> tget(Integer id,List<Integer> isFinish,List<String> tags) {
|
||||
log.info("DAO层");
|
||||
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.tgetBytags(tags,isFinish);
|
||||
}
|
||||
|
||||
if(isFinish != null && !isFinish.isEmpty()){
|
||||
return projectMapper.tgetByIsfinish(isFinish);
|
||||
}
|
||||
if(tags != null && !tags.isEmpty()){
|
||||
return projectMapper.tgetBytags(tags);
|
||||
}
|
||||
|
||||
return projectMapper.tget(id);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public interface ProjectMapper {
|
||||
//@Select("select * from organize_oa.oa_project where is_finish=#{isFinish} and is_delete=false and principal_id=#{userId}")
|
||||
List<ProjectDO>getByIsfinish(Long userId,List<Integer> isFinish);
|
||||
|
||||
List<ProjectDO>getByTags(Long userId,List<String> tags);
|
||||
List<ProjectDO>getByTags(Long userId,List<String> tags,List<Integer> isFinish);
|
||||
|
||||
@Select("select * from organize_oa.oa_project where is_delete=false and status=1 and principal_id=#{userId}")
|
||||
List<ProjectDO> get(Long userId);
|
||||
@ -88,7 +88,7 @@ public interface ProjectMapper {
|
||||
//@Select("select * from organize_oa.oa_project_work where is_finish=#{isFinish} and is_delete=false and principal_id =#{userId}")
|
||||
List<ProjectDO> workgetByIsfinish(Long userId, List<Integer> isFinish, Integer is);
|
||||
|
||||
List<ProjectDO> workgetByTags(Long userId, List<String> tags, Integer is);
|
||||
List<ProjectDO> workgetByTags(Long userId, List<String> tags, Integer is,List<Integer> isFinish);
|
||||
|
||||
//@Select("select * from organize_oa.oa_project where id in(select project_id from " +
|
||||
//"organize_oa.oa_project_work where is_delete=false and status =1 and principal_id=#{userId} and type=0)")
|
||||
@ -102,5 +102,5 @@ public interface ProjectMapper {
|
||||
|
||||
List<ProjectDO> tgetByIsfinish(List<Integer> isFinish);
|
||||
|
||||
List<ProjectDO> tgetBytags(List<String> tags);
|
||||
List<ProjectDO> tgetBytags(List<String> tags,List<Integer> isFinish);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public interface RoleMapper {
|
||||
@Insert("insert into organize_oa.oa_role_user (uid, rid) VALUE (#{uid},#{rid})")
|
||||
void roleAddUser(Long uid, Long rid);
|
||||
|
||||
@Select("INSERT INTO organize_oa.oa_role (role_name,display_name) VALUES (#{roleName}, ${display_name})")
|
||||
@Select("INSERT INTO organize_oa.oa_role (role_name,display_name) VALUES (#{roleName}, #{displayName})")
|
||||
void roleAdd(RoleDO roleDO);
|
||||
|
||||
@Delete("delete from organize_oa.oa_role_user where uid=#{uid}")
|
||||
|
@ -15,7 +15,7 @@ import java.sql.Timestamp;
|
||||
*/
|
||||
@Data
|
||||
public class TagProjectDO {
|
||||
private String id;
|
||||
private Long id;
|
||||
private String name;
|
||||
private Long pid;
|
||||
private Timestamp createdAt;
|
||||
|
@ -22,6 +22,7 @@ public class CarouselDO {
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class DataDO {
|
||||
private Integer id;
|
||||
private Integer displayOrder;
|
||||
private String image;
|
||||
private String title;
|
||||
|
@ -48,7 +48,7 @@ public class AuthServiceImpl implements AuthService {
|
||||
|
||||
@Override
|
||||
public BaseResponse authRegister(@NotNull UserRegisterVO userRegisterVO) {
|
||||
log.info("\t> 执行 Service 层 AuthService.userEdit 方法");
|
||||
log.info("\t> 执行 Service 层 AuthService.authRegister 方法");
|
||||
// 检查用户说是否存在
|
||||
UserDO getUserByUsername = userMapper.getUserInfoByUsername(userRegisterVO.getUsername());
|
||||
// 用户名已存在
|
||||
@ -75,8 +75,8 @@ public class AuthServiceImpl implements AuthService {
|
||||
if (userMapper.insertUser(userDO)) {
|
||||
userDO.setPassword(null);
|
||||
//默认角色为学生
|
||||
UserDO userDO1 = userMapper.getUserByUserNum(userDO.getUsername());
|
||||
roleDAO.addRoleUser(userDO1.getId(), 2L);
|
||||
UserDO getUserDO = userMapper.getUserInfoByUsername(userDO.getUsername());
|
||||
roleDAO.addRoleUser(getUserDO.getId(), 2L);
|
||||
return ResultUtil.success("注册成功", userDO);
|
||||
} else {
|
||||
return ResultUtil.error(ErrorCode.DATABASE_INSERT_ERROR);
|
||||
|
@ -64,13 +64,14 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
@Override
|
||||
public BaseResponse tget(Integer id, List<String> tags, List<Integer> isFinish) {
|
||||
log.info("\t> 执行 Service 层 ProjectService.tget 方法");
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
//根据标签查询
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.tget(id,isFinish,tags);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
//根据标签查询
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.tget(id,isFinish,tags);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
@ -245,17 +246,19 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
|
||||
//获取用户
|
||||
Long userId = Processing.getAuthHeaderToUserId(request);
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.get(userId, listAll, tags, isFinish);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
//根据标签查询
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.get(userId, listAll, tags, isFinish);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.get(userId, listAll, tags, isFinish);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
|
||||
//判断是否是老师(项目负责人)
|
||||
if (listAll != null && Processing.checkUserIsTeacher(request, roleMapper)) {
|
||||
List<ProjectDO> projectDOList = projectDAO.get(userId, listAll, tags, isFinish);
|
||||
@ -274,17 +277,20 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
|
||||
//获取用户
|
||||
Long userId = Processing.getAuthHeaderToUserId(request);
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.workget(userId, listAll, tags, isFinish,is);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
//根据标签查询
|
||||
if (tags != null && !tags.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.workget(userId, listAll, tags, isFinish,is);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
//根据状态查询
|
||||
if (isFinish != null && !isFinish.isEmpty()) {
|
||||
List<ProjectDO> projectDOList = projectDAO.workget(userId, listAll, tags, isFinish,is);
|
||||
return ResultUtil.success(projectDOList);
|
||||
}
|
||||
|
||||
|
||||
//判断是否是老师(项目负责人)
|
||||
if (listAll != null && Processing.checkUserIsTeacher(request, roleMapper)) {
|
||||
List<ProjectDO> projectDOList = projectDAO.workget(userId, listAll, tags, isFinish,is);
|
||||
|
@ -17,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -25,12 +26,12 @@ import java.util.regex.Pattern;
|
||||
* <hr/>
|
||||
* 用于权限服务层的实现类,实现权限的增删改查,以及用户权限的获取
|
||||
*
|
||||
* @since v1.1.0
|
||||
* @author xiao_lfeng | 176yunxuan | xiangZr-hhh
|
||||
* @version v1.1.0
|
||||
* @see com.jsl.oa.services.RoleService
|
||||
* @see com.jsl.oa.dao.RoleDAO
|
||||
* @see com.jsl.oa.dao.UserDAO
|
||||
* @author xiao_lfeng | 176yunxuan | xiangZr-hhh
|
||||
* @since v1.1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -171,8 +172,10 @@ public class RoleServiceImpl implements RoleService {
|
||||
String roleName = roleAddVO.getName();
|
||||
RoleDO roleDO = new RoleDO();
|
||||
if (!roleDAO.isExistRoleByRoleName(roleName)) {
|
||||
Processing.copyProperties(roleAddVO, roleDO);
|
||||
roleDO.setRoleName(roleAddVO.getName());
|
||||
roleDO
|
||||
.setRoleName(roleAddVO.getName())
|
||||
.setDisplayName(roleAddVO.getDisplayName())
|
||||
.setCreatedAt(new Timestamp(System.currentTimeMillis()));
|
||||
} else {
|
||||
return ResultUtil.error(ErrorCode.ROLE_NAME_REPEAT);
|
||||
}
|
||||
|
@ -48,12 +48,22 @@
|
||||
</update>
|
||||
|
||||
<select id="getByTags" resultType="com.jsl.oa.model.doData.ProjectDO">
|
||||
select * from organize_oa.oa_project where is_delete=false and principal_id=#{userId} and status=1 and
|
||||
<foreach collection="tags" item="tag" separator=",'%') or json_extract(tags,'$.tags')like concat('%',"
|
||||
open="json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%')">
|
||||
#{tag}
|
||||
</foreach>
|
||||
<if test="tags != null">
|
||||
select * from organize_oa.oa_project where is_delete=false and principal_id=#{userId} and status=1 and
|
||||
|
||||
<if test="isFinish != null and isFinish.size() > 0">
|
||||
is_finish in
|
||||
<foreach collection="isFinish" item="Finish" separator="," open="(" close=") and">
|
||||
#{Finish}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<foreach collection="tags" item="tag" separator=",'%') or json_extract(tags,'$.tags')like concat('%',"
|
||||
open="(json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%'))">
|
||||
#{tag}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getByIsfinish" resultType="com.jsl.oa.model.doData.ProjectDO">
|
||||
@ -71,8 +81,14 @@
|
||||
(principal_id = #{userId} and is_delete=false) or
|
||||
</if>
|
||||
id in(select project_id from organize_oa.oa_project_work
|
||||
where is_delete=false and (principal_id=#{userId} ) and project_id in(
|
||||
select id from organize_oa.oa_project where
|
||||
where is_delete=false and (principal_id=#{userId} ) and
|
||||
<if test="isFinish != null and isFinish.size() > 0">
|
||||
is_finish in
|
||||
<foreach collection="isFinish" item="Finish" separator="," open="(" close=") and">
|
||||
#{Finish}
|
||||
</foreach>
|
||||
</if>
|
||||
project_id in(select id from organize_oa.oa_project where
|
||||
<foreach collection="tags" item="tag" separator=",'%') or json_extract(tags,'$.tags')like concat('%',"
|
||||
open="json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%')))">
|
||||
@ -115,9 +131,16 @@
|
||||
|
||||
<select id="tgetBytags" resultType="com.jsl.oa.model.doData.ProjectDO">
|
||||
select * from organize_oa.oa_project where is_delete=false and status=1 and
|
||||
<if test="isFinish != null and isFinish.size() > 0">
|
||||
is_finish in
|
||||
<foreach collection="isFinish" item="Finish" separator="," open="(" close=") and">
|
||||
#{Finish}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<foreach collection="tags" item="tag" separator=",'%') or json_extract(tags,'$.tags')like concat('%',"
|
||||
open="json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%')">
|
||||
open="(json_extract(tags,'$.tags')like concat('%',"
|
||||
close=",'%'))">
|
||||
#{tag}
|
||||
</foreach>
|
||||
</select>
|
||||
|
Loading…
x
Reference in New Issue
Block a user