20基于java的科研管理系统设计与实现

背景及意义

目前许多人仍将传统的纸质工具作为信息管理的主要工具,而网络技术的应用只是起到辅助作用。在对网络工具的认知程度上,较为传统的office软件等仍是人们使用的主要工具,而相对全面且专业的信息管理软件仍没有得到大多数人的了解或认可。本选题则旨在通过标签分类管理等方式,实现教研的各种功能,从而达到对科研管理系统的管理。

科研项目管理系统,以项目化管理为思想,以现实中管理制度为核心,对科研项目申报、项目开题、项目合同、实施进度、项目风险分析及控制计划、项目经费、项目质量、项目文档、科研成果等科研活动全面管理,实现科研项目“管理标准的沉淀优化、组织流程的优化、管理水平的提升、内外部资源整合的延伸”,保障科研项目完成与落实,出人才、出成果、出效益,提高竞争力。

主要功能

项目主要分为3个角色,分别是超级管理员,教师和学生,超级管理员具有项目所有的权限,包括有用户管理,角色管理,权限管理,项目管理,申报管理,变更管理,结题管理,数据字典等功能;学生学生负责对项目的申报,变更,结题申请等,教师负责对学生提交的项目进行审核。

项目搭建环境

> java jdk版本:1.8及以上
> 后台框架:java spring springmvc mybatis springbotoot等
> 前端框架:html css javascript vue等
> 开发工具: idea或者eclipse都可
> 数据库: mysql 5.7及以上
> 服务器: tomcat
> 更多内容可查看:http://projecthelp.top

部分核心代码

import org.springframework.stereotype.Service;
import xyz.shiguangliang.mybatis.dao.UserMapper;

import xyz.shiguangliang.mybatis.domain.User;
import xyz.shiguangliang.service.UserService;
import xyz.shiguangliang.util.query.QueryInfo;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    //登录
    @Override
    public User login(String username, String password) {
        User user = userMapper.selectLogin(username,password);
        if (user != null) {
            //登录次数加一
            if (user.getIntimes() !=  null) {
                user.setIntimes(user.getIntimes() + 1);
            }else {
                user.setIntimes(1);
            }
            //更新登录时间
            user.setLastlogin(new Date());
            return user;
        }
        return null;
    }

    //注册
    @Override
    public boolean register(User user) {
        int i = 0;
        //检测用户是否存在
        User user1 = userMapper.selectUsername(user.getUsername());
        if (user1 == null) {
            i = userMapper.insert(user);
        }
        return i > 0;
    }

    //用户列表
    @Override
    public QueryInfo getUserList(String query, Integer pagenum,Integer pagesize) {
        QueryInfo queryInfo = new QueryInfo();
        int start;
        int end;
        if (pagenum == null||pagesize == null){
            pagenum =0;
            pagesize = 3;
        }
        start = (pagenum-1)*pagesize;
        end = pagesize;
        int userSize = userMapper.selectUserListLimitSize(query,start,end);
        List<User> users = userMapper.selectUserListLimit(query,start,end);
        queryInfo.setList(users);
        queryInfo.setTotal(userSize);
        return queryInfo;
    }

    //删除用户
    @Override
    public int deleteUser(Integer tid) {
        return userMapper.deleteByPrimaryKey(tid);
    }

    //通过id查找用户
    @Override
    public User findById(Integer tid) {
        return userMapper.selectByPrimaryKey(tid);
    }



    //更新用户
    @Override
    public int updateUser(User user) {
        if (user.getPassword()==null|| Objects.equals(user.getPassword(), "")){
            user.setPassword(userMapper.selectByPrimaryKey(user.getTid()).getPassword());
        }
        return userMapper.updateByPrimaryKey(user);
    }

    //通过用户名查找用户
    @Override
    public User findByUsername(String username) {
        return userMapper.selectUsername(username);
    }

    //获取用户权限
    @Override
    public int getPower(String username) {
        return userMapper.selectUsername(username).getPower();
    }
}

useMapper.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="xyz.shiguangliang.mybatis.dao.UserMapper">
  <resultMap id="BaseResultMap" type="xyz.shiguangliang.mybatis.domain.User">
    <id column="tid" jdbcType="INTEGER" property="tid" />
    <result column="username" jdbcType="VARCHAR" property="username" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="teachername" jdbcType="VARCHAR" property="teachername" />
    <result column="dno" jdbcType="INTEGER" property="dno" />
    <result column="power" jdbcType="INTEGER" property="power" />
    <result column="intimes" jdbcType="INTEGER" property="intimes" />
    <result column="lastlogin" jdbcType="TIMESTAMP" property="lastlogin" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from teacher
    where tid = #{tid,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="xyz.shiguangliang.mybatis.domain.User">
    insert into teacher (tid, username, password, 
      teachername, dno, power, 
      intimes, lastlogin)
    values (#{tid,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, 
      #{teachername,jdbcType=VARCHAR}, #{dno,jdbcType=INTEGER}, #{power,jdbcType=INTEGER}, 
      #{intimes,jdbcType=INTEGER}, #{lastlogin,jdbcType=TIMESTAMP})
  </insert>
  <update id="updateByPrimaryKey" parameterType="xyz.shiguangliang.mybatis.domain.User">
    update teacher
    set username = #{username,jdbcType=VARCHAR},
      password = #{password,jdbcType=VARCHAR},
      teachername = #{teachername,jdbcType=VARCHAR},
      dno = #{dno,jdbcType=INTEGER},
      power = #{power,jdbcType=INTEGER},
      intimes = #{intimes,jdbcType=INTEGER},
      lastlogin = #{lastlogin,jdbcType=TIMESTAMP}
    where tid = #{tid,jdbcType=INTEGER}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select tid, username, password, teachername, dno, power, intimes, lastlogin
    from teacher
    where tid = #{tid,jdbcType=INTEGER}
  </select>
  <select id="selectAll" resultMap="BaseResultMap">
    select tid, username, password, teachername, dno, power, intimes, lastlogin
    from teacher
  </select>
    <select id="selectLogin" resultType="xyz.shiguangliang.mybatis.domain.User">
        select tid, username, password, teachername, dno, power, intimes, lastlogin
        from teacher
        where username = #{username} and password = #{password}
    </select>
  <select id="selectUsername" resultType="xyz.shiguangliang.mybatis.domain.User">
    select tid, username, password, teachername, dno, power, intimes, lastlogin
        from teacher
        where username = #{username}
  </select>
  <select id="selectUserListLimit" resultType="xyz.shiguangliang.mybatis.domain.User">
    select tid, username, password, teachername, dno, power, intimes, lastlogin
    from teacher
    where
    /*条件判断*/
    <if test="#{query} != null and #{query} != ''">
      /*模糊查询*/
      <bind name="query2" value="'%' + query + '%'"/>
      username like #{query2}
    </if>
    LIMIT #{start},#{end}
  </select>
  <select id="selectUserListLimitSize" resultType="java.lang.Integer">
    select count(*)
    from teacher
    where
    /*条件判断*/
    <if test="#{query} != null and #{query} != ''">
      /*模糊查询*/
      <bind name="query2" value="'%' + query + '%'"/>
      username like #{query2}
    </if>
  </select>
</mapper>
  • Project实体类
@Entity
@Table(name = BaseEntity.TABLE_PREFIX + "PROJECT")
public class Project extends BaseEntity{
    //项目名
    @Column(name = "name",nullable = false)
    private String name;
    //项目级别
    @Column(name = "level",nullable = false)
    private String level;
    //负责人
    @Column(name = "user_name",nullable = false)
    private String userName;
    //成员
    @Column(name = "memberJsons",nullable = false)
    private String memberJsons;
    //资金
    @Fetch(FetchMode.SUBSELECT)
    @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY,targetEntity = Fund.class,mappedBy = "projectId")
    private List<Fund> funds;
    //项目结果类型
    @Column(name = "achievement_type",nullable = false)
    private String achievementType;
    //开始时间
    @Column(name = "begin_time",nullable = false)
    private Date beginTime;
    //学科
    @Column(name = "subject",nullable = false)
    private String subject;
    //预期结果
    @Column(name = "expected_result",nullable = false)
    private String expectedResult;
    //立项目的
    @Column(name = "purpose",nullable = false)
    private String purpose;
    //研究方案可行性分析
    @Column(name = "viable_analysis",nullable = false)
    private String viableAnalysis;
    //社会效益分析
    @Column(name = "economic_analysis",nullable = false)
    private String economicAnalysis;
    //现有条件
    @Column(name = "existing_conditions",nullable = false)
    private String existingConditions;
    //所属学院
    @Column(name = "college" , nullable = false)
    private String college;
    //项目状态
    @Column(name = "status",nullable = false)
    private int status;
    //是否可以修改
    @Column(name = "can_update" )
    private boolean canUpdate;
    //是否可以申报
    @Column(name = "can_application")
    private boolean canApplication;
    //是否可以结题
    @Column(name = "can_conclude")
    private boolean canConclude;
    //创建人
    @Column(name = "created_user",nullable = false)
    private String createdUser;
}

项目实现类

@Service
public class ProjectApplicationServiceImpl extends BaseServiceImpl<ProjectApplication> implements IProjectApplicationService {

    public ProjectApplicationServiceImpl(BaseRepository<ProjectApplication> repository) {
        super(repository);
    }

    @Autowired
    private ProjectApplicationRepository projectApplicationRepository;

    @Autowired
    private IProjectService projectService;

    @Override
    @Transactional
    public ProjectApplication toApplication(ProjectApplication projectApplication) {
        projectApplication.setStatus(ApplicationStatus.ON_APPLIACTION.getName());
        projectApplication.setApplicant(CurrentUserUtils.getCurrentUser().getSecurityUserDto().getUserName());
        projectApplication.setApplicateTime(new Date());
        ProjectApplication savedPorjectAppication = projectApplicationRepository.save(projectApplication);
        //项目申报中  项目申报 不可修改 不可申报 不可以申请变更 不可结题
        projectService.changeStatus(projectApplication.getProjectId(), ProjectStatus.PROJECT_AUDIT);
        return savedPorjectAppication;
    }

    @Override
    @Transactional
    public ProjectApplication applicationPass(ProjectApplication projectApplication) {
        projectApplication.setStatus(ApplicationStatus.SUCCESS_APPLICATION.getName());
        ProjectApplication updatedProjectApplication = projectApplicationRepository.save(projectApplication);
        //未结题 结题之前的状态 不可修改 不可以申报 可以申请变更 可以申请结题
        projectService.changeStatus(projectApplication.getProjectId(),ProjectStatus.NOT_CONCLUSION);
        return updatedProjectApplication;
    }

    @Override

    public ProjectApplication applicationNotPass(ProjectApplication projectApplication) {
        projectApplication.setStatus(ApplicationStatus.FAIL_APPLICATION.getName());
        ProjectApplication updatedProjectApplication = projectApplicationRepository.save(projectApplication);
        //申报失败 等同草稿 可以修改 可以申报 不可以申请变更 不可以结题
        projectService.changeStatus(projectApplication.getProjectId(),ProjectStatus.FAIL_PROJECT_AUDIT);
        return updatedProjectApplication;
    }
}

数据库的设计

项目部分功能展示

  • 登录页面
  • 管理员功能

  • 教师角色
  • 学生角色

热门相关:骑士归来   名门天后:重生国民千金   最强装逼打脸系统   夫人,你马甲又掉了!   学霸女神超给力