目录
大家好呀,我是一个混迹在java圈的码农。今天要和大家分享的是 一款基于SpringBoot+Vue的科研项目验收管理系统,项目源码请点击文章末尾联系我哦~目前有各类成品 毕设 JavaWeb SSM SpringBoot等等项目框架,源码丰富,欢迎咨询。
一、项目介绍
使用旧方法对科研项目信息进行系统化管理已经不再让人们信赖了,把现在的网络信息技术运用在科研项目信息的管理上面可以解决许多信息管理上面的难题,比如处理数据时间很长,数据存在错误不能及时纠正等问题。这次开发的科研项目验收管理系统对景点城市信息,科研项目信息,评论信息,自助资讯信息等进行集中化处理。经过前面自己查阅的网络知识,加上自己在学校课堂上学习的知识,决定开发系统选择B/S模式这种高效率的模式完成系统功能开发。这种模式让操作员基于浏览器的方式进行网站访问,采用的主流的Java语言这种面向对象的语言进行科研项目验收管理系统程序的开发,在数据库的选择上面,选择功能强大的Mysql数据库进行数据的存放操作。科研项目验收管理系统的开发让用户查看景点信息变得容易,让管理员高效管理景点信息。
关键词:科研项目验收管理系统; 评论;自助资讯
二、开发环境
开发系统:Windows
JDK版本:Java JDK1.8(推荐)
开发工具:IDEA/MyEclipse(推荐IDEA)
数据库版本: mysql8.0(推荐)
数据库可视化工具: navicat
服务器:SpringBoot自带 apache tomcat
框架:springboot,vue
三、功能介绍
项目管理页面提供的功能操作有:查看项目,删除项目操作。公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。公告类型管理页面显示所有公告类型,可以添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。
四、核心代码
/**
* 项目管理员
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/xiangmuguanliyuan")
public class XiangmuguanliyuanController {
private static final Logger logger = LoggerFactory.getLogger(XiangmuguanliyuanController.class);
@Autowired
private XiangmuguanliyuanService xiangmuguanliyuanService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private YonghuService yonghuService;
@Autowired
private ZhuanjiaService zhuanjiaService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("项目管理员".equals(role))
params.put("xiangmuguanliyuanId",request.getSession().getAttribute("userId"));
else if("专家账户".equals(role))
params.put("zhuanjiaId",request.getSession().getAttribute("userId"));
params.put("xiangmuguanliyuanDeleteStart",1);params.put("xiangmuguanliyuanDeleteEnd",1);
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = xiangmuguanliyuanService.queryPage(params);
//字典表数据转换
List<XiangmuguanliyuanView> list =(List<XiangmuguanliyuanView>)page.getList();
for(XiangmuguanliyuanView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
XiangmuguanliyuanEntity xiangmuguanliyuan = xiangmuguanliyuanService.selectById(id);
if(xiangmuguanliyuan !=null){
//entity转view
XiangmuguanliyuanView view = new XiangmuguanliyuanView();
BeanUtils.copyProperties( xiangmuguanliyuan , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody XiangmuguanliyuanEntity xiangmuguanliyuan, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,xiangmuguanliyuan:{}",this.getClass().getName(),xiangmuguanliyuan.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
Wrapper<XiangmuguanliyuanEntity> queryWrapper = new EntityWrapper<XiangmuguanliyuanEntity>()
.eq("username", xiangmuguanliyuan.getUsername())
.or()
.eq("xiangmuguanliyuan_phone", xiangmuguanliyuan.getXiangmuguanliyuanPhone())
.or()
.eq("xiangmuguanliyuan_id_number", xiangmuguanliyuan.getXiangmuguanliyuanIdNumber())
.andNew()
.eq("xiangmuguanliyuan_delete", 1)
;
XiangmuguanliyuanEntity xiangmuguanliyuanEntity = xiangmuguanliyuanService.selectOne(queryWrapper);
if(xiangmuguanliyuanEntity==null){
xiangmuguanliyuan.setXiangmuguanliyuanDelete(1);
xiangmuguanliyuan.setCreateTime(new Date());
xiangmuguanliyuan.setPassword("123456");
xiangmuguanliyuanService.insert(xiangmuguanliyuan);
return R.ok();
}else {
return R.error(511,"账户或者联系电话或者项目管理员身份证号已经被使用");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody XiangmuguanliyuanEntity xiangmuguanliyuan, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,xiangmuguanliyuan:{}",this.getClass().getName(),xiangmuguanliyuan.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
//根据字段查询是否有相同数据
Wrapper<XiangmuguanliyuanEntity> queryWrapper = new EntityWrapper<XiangmuguanliyuanEntity>()
.notIn("id",xiangmuguanliyuan.getId())
.andNew()
.eq("username", xiangmuguanliyuan.getUsername())
.or()
.eq("xiangmuguanliyuan_phone", xiangmuguanliyuan.getXiangmuguanliyuanPhone())
.or()
.eq("xiangmuguanliyuan_id_number", xiangmuguanliyuan.getXiangmuguanliyuanIdNumber())
.andNew()
.eq("xiangmuguanliyuan_delete", 1)
;
XiangmuguanliyuanEntity xiangmuguanliyuanEntity = xiangmuguanliyuanService.selectOne(queryWrapper);
if("".equals(xiangmuguanliyuan.getXiangmuguanliyuanPhoto()) || "null".equals(xiangmuguanliyuan.getXiangmuguanliyuanPhoto())){
xiangmuguanliyuan.setXiangmuguanliyuanPhoto(null);
}
if(xiangmuguanliyuanEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// xiangmuguanliyuan.set
// }
xiangmuguanliyuanService.updateById(xiangmuguanliyuan);//根据id更新
return R.ok();
}else {
return R.error(511,"账户或者联系电话或者项目管理员身份证号已经被使用");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
ArrayList<XiangmuguanliyuanEntity> list = new ArrayList<>();
for(Integer id:ids){
XiangmuguanliyuanEntity xiangmuguanliyuanEntity = new XiangmuguanliyuanEntity();
xiangmuguanliyuanEntity.setId(id);
xiangmuguanliyuanEntity.setXiangmuguanliyuanDelete(2);
list.add(xiangmuguanliyuanEntity);
}
if(list != null && list.size() >0){
xiangmuguanliyuanService.updateBatchById(list);
}
return R.ok();
}
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
XiangmuguanliyuanEntity xiangmuguanliyuan = xiangmuguanliyuanService.selectOne(new EntityWrapper<XiangmuguanliyuanEntity>().eq("username", username));
if(xiangmuguanliyuan==null || !xiangmuguanliyuan.getPassword().equals(password))
return R.error("账号或密码不正确");
else if(xiangmuguanliyuan.getXiangmuguanliyuanDelete() != 1)
return R.error("账户已被删除");
// // 获取监听器中的字典表
// ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
// Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");
// Map<Integer, String> role_types = dictionaryMap.get("role_types");
// role_types.get(.getRoleTypes());
String token = tokenService.generateToken(xiangmuguanliyuan.getId(),username, "xiangmuguanliyuan", "项目管理员");
R r = R.ok();
r.put("token", token);
r.put("role","项目管理员");
r.put("username",xiangmuguanliyuan.getXiangmuguanliyuanName());
r.put("tableName","xiangmuguanliyuan");
r.put("userId",xiangmuguanliyuan.getId());
return r;
}
/**
* 注册
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody XiangmuguanliyuanEntity xiangmuguanliyuan){
// ValidatorUtils.validateEntity(user);
Wrapper<XiangmuguanliyuanEntity> queryWrapper = new EntityWrapper<XiangmuguanliyuanEntity>()
.eq("username", xiangmuguanliyuan.getUsername())
.or()
.eq("xiangmuguanliyuan_phone", xiangmuguanliyuan.getXiangmuguanliyuanPhone())
.or()
.eq("xiangmuguanliyuan_id_number", xiangmuguanliyuan.getXiangmuguanliyuanIdNumber())
.andNew()
.eq("xiangmuguanliyuan_delete", 1)
;
XiangmuguanliyuanEntity xiangmuguanliyuanEntity = xiangmuguanliyuanService.selectOne(queryWrapper);
if(xiangmuguanliyuanEntity != null)
return R.error("账户或者联系电话或者项目管理员身份证号已经被使用");
xiangmuguanliyuan.setXiangmuguanliyuanDelete(1);
xiangmuguanliyuan.setCreateTime(new Date());
xiangmuguanliyuanService.insert(xiangmuguanliyuan);
return R.ok();
}
/**
* 重置密码
*/
@GetMapping(value = "/resetPassword")
public R resetPassword(Integer id){
XiangmuguanliyuanEntity xiangmuguanliyuan = new XiangmuguanliyuanEntity();
xiangmuguanliyuan.setPassword("123456");
xiangmuguanliyuan.setId(id);
xiangmuguanliyuanService.updateById(xiangmuguanliyuan);
return R.ok();
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrXiangmuguanliyuan(HttpServletRequest request){
Integer id = (Integer)request.getSession().getAttribute("userId");
XiangmuguanliyuanEntity xiangmuguanliyuan = xiangmuguanliyuanService.selectById(id);
if(xiangmuguanliyuan !=null){
//entity转view
XiangmuguanliyuanView view = new XiangmuguanliyuanView();
BeanUtils.copyProperties( xiangmuguanliyuan , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
}
五、效果图
六、源码获取:
同系统在主页搜索资源可下载~