package fun.kwok.natserver.controller;
import fun.kwok.natserver.entity.ResultInfo;
import fun.kwok.natserver.entity.SystemUser;
import fun.kwok.natserver.service.*;
import fun.kwok.natserver.utils.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Controller
public class AdminController {
@Autowired
ResultService resultService;
@Autowired
SystemUserService systemUserService;
@Autowired
JobService jobService;
@Autowired
TubeService tubeService;
@Autowired
TubeUserService tubeUserService;
@Autowired
UserInfoService userInfoService;
@ResponseBody
@PostMapping("/admin/getGroup")
@PreAuthorize("hasRole('ROLE_GROUP') or hasRole('ROLE_ADMIN')")
public ResultInfo getGroup(HttpSession session){
SystemUser systemUser= (SystemUser) session.getAttribute("user");
if (systemUser.getRole()==0)
return new ResultInfo(true,200,"success",systemUserService.getGroup());
else if (systemUser.getRole()==1) {
List<SystemUser> systemUserList = new ArrayList<SystemUser>();
systemUserList.add(systemUser);
return new ResultInfo(true, 200, "success", systemUserList);
}
return new ResultInfo(false,null,"未知错误",null);
}
@ResponseBody
@PostMapping("/admin/getJob")
@PreAuthorize("hasRole('ROLE_GROUP') or hasRole('ROLE_ADMIN')")
public ResultInfo getJob(@RequestParam(value="groupid",required=false) Integer groupid,
@RequestParam(value="status",required=false) Integer status,
HttpSession session){
SystemUser systemUser= (SystemUser) session.getAttribute("user");
if (systemUser.getRole()==0)
return new ResultInfo(true,200,"success",jobService.getAllJobByGroupId(groupid,status));
else if (systemUser.getRole()==1){
return new ResultInfo(true,200,"success",jobService.getAllJobByGroupId(systemUser.getId(),status));
}
return new ResultInfo(false,null,"未知错误",null);
}
@ResponseBody
@PostMapping("/admin/getJobData") //获取任务分页列表
@PreAuthorize("hasRole('ROLE_GROUP') or hasRole('ROLE_ADMIN')")
public ResultInfo getJobData(
@RequestParam("pageNum") Integer pageNum,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value="groupid",required=false) Integer groupid,
@RequestParam(value="status",required=false) Integer status,
HttpSession session){
SystemUser systemUser= (SystemUser) session.getAttribute("user");
if (systemUser.getRole()==0)
return new ResultInfo(true,200,"success",jobService.getJobData(pageNum,pageSize,groupid,status));
else if (systemUser.getRole()==1){
return new ResultInfo(true,200,"success",jobService.getJobData(pageNum,pageSize,systemUser.getId(),status));
}
return new ResultInfo(false,null,"未知错误",null);
}
@ResponseBody
@GetMapping("/admin/getTubeCount")
@PreAuthorize("hasRole('ROLE_GROUP') or hasRole('ROLE_ADMIN')")
public ResultInfo getTubeCount(HttpSession session){
SystemUser systemUser= (SystemUser) session.getAttribute("user");
Integer groupid;
if (systemUser.getRole()==0)
groupid=null;
else
groupid=systemUser.getId();
int[] result=new int[3];
result[0]=tubeService.countTube(groupid);// 已采集试管
result[1]=tubeService.countTubeStatus12(groupid);//已检测试管
result[2]=tubeService.countTubeStatus1(groupid);//阴性试管
return new ResultInfo(true,200,"success",result);
}
@ResponseBody
@GetMapping("/admin/getTubeUserCount")
@PreAuthorize("hasRole('ROLE_ADMIN')")
public ResultInfo getTubeUserCount( ){
int[] result=new int[3];
result[0]=tubeUserService.countTubeUser();// 已采集人次
result[1]=tubeUserService.countTubeUser12();//已检测人次
result[2]=tubeUserService.countTubeUser1();//阴性人次
return new ResultInfo(true,200,"success",result);
}
@ResponseBody
@GetMapping("/admin/getUserInfoCount")
@PreAuthorize("hasRole('ROLE_ADMIN')")
public ResultInfo getUserInfoCount( ){
return new ResultInfo(true,200,"success",userInfoService.userInfoCount());
}
@ResponseBody
@PostMapping("/admin/addJob")//添加任务
@PreAuthorize("hasRole('ROLE_GROUP') or hasRole('ROLE_ADMIN')")
public ResultInfo addJob(
@RequestParam("jobname") String jobname,
@RequestParam("groupid") Integer groupid,
HttpSession session){
SystemUser systemUser= (SystemUser) session.getAttribute("user");
int flag=0;
if (systemUser.getRole()==0)
flag=jobService.addJob(jobname,groupid);
else
flag=jobService.addJob(jobname,systemUser.getId());
if (flag>0)
return new ResultInfo(true,null,"添加成功",null);
else
return new ResultInfo(false,null,"添加失败",null);
}
@ResponseBody
@PostMapping("/admin/finishJob")//添加任务
@PreAuthorize("hasRole('ROLE_GROUP') or hasRole('ROLE_ADMIN')")
public ResultInfo finishJob(
@RequestParam("jobid") Integer jobid,
HttpSession session){
SystemUser systemUser= (SystemUser) session.getAttribute("user");
int flag=0;
if (systemUser.getRole()==0)
flag=jobService.finishjob(jobid,null);
else
flag=jobService.finishjob(jobid,systemUser.getId());
if (flag>0)
return new ResultInfo(true,null,"设置任务状态成功",null);
else
return new ResultInfo(false,null,"设置任务状态失败",null);
}
@ResponseBody
@PostMapping("/admin/getResult")
@PreAuthorize("hasRole('ROLE_ADMIN')")
public ResultInfo getResult(@RequestParam("pageNum") Integer pageNum,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value="tubeid",required=false) String tubeid,
@RequestParam(value="idcardnum",required=false) String idcardnum,
@RequestParam(value="status",required=false) Integer status,
@RequestParam(value="operatorid",required=false) Integer operatorid,
@RequestParam(value="jobid",required=false) Integer jobid,
@RequestParam(value="groupid",required=false) Integer groupid,
@RequestParam(value="time1",required=false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date time1,
@RequestParam(value="time2",required=false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date time2
){
if ("".equals(idcardnum))
idcardnum=null;
if ("".equals(tubeid))
tubeid=null;
return new ResultInfo(true,200,"success",
resultService.getAllResult(pageNum,pageSize,idcardnum,tubeid,status,operatorid
,jobid,groupid,time1,time2));
}
@ResponseBody
@PostMapping("/admi
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于SpringBoot+Vue核酸检测登记查询系统源码+项目说明.zip 【资源介绍】 核酸检测登记查询系统 natweb目录为前端项目 采用Vue+ElementUI+VantUI natserver目录为后端项目 采用SpringBoot+SpringSecurity+Mybatis+MySQL nat.sql 为数据库文件,nat_with_v2_system为兼容微信登录和非微信登陆的数据库 (admin默认密码为123456) 项目功能简介 用户端 (路径:/#/user) 个人信息登记、个人信息二维码展示、检测结果查询 目前可以支持不使用微信平台来进行用户数据录入功能,添加了一套独立的用户登录功能(开关位于UserLoginConfig.useWechet),请使用nat.sql数据库文件来兼容独立用户登录功能和硬件节点信息功能 采集端 (路径:/#/operator) 通过扫描试管条码和个人信息二维码进行信息录入 chrome 在47后调用navigator.mediaDevices.getUserMedia 仅能在在https和 loaclhost环境
资源推荐
资源详情
资源评论
收起资源包目录
基于SpringBoot+Vue核酸检测登记查询系统源码+项目说明.zip (94个子文件)
说明.md 2KB
natweb
babel.config.js 54B
src
App.vue 212B
assets
核酸检测.png 307KB
css
color-dark.css 448B
main.css 3KB
main.js 897B
components
js
GetUrlParam.js 190B
admin
Dashboard.vue 12KB
TubeManage.vue 11KB
ResultTable.vue 9KB
UserInfo.vue 4KB
SystemUser.vue 10KB
common
Tags.vue 6KB
bus.js 92B
directives.js 3KB
Sidebar.vue 4KB
Header.vue 5KB
Home.vue 1KB
Login.vue 5KB
JobManage.vue 8KB
user
infoEdit.vue 6KB
search.vue 3KB
userInfo.vue 4KB
systemLogin.vue 2KB
index.vue 861B
infoView.vue 6KB
operator
login.vue 2KB
index.vue 10KB
selectJob.vue 2KB
router
index.js 4KB
package.json 796B
public
index.html 367B
config.js 169B
package-lock.json 475KB
vue.config.js 776B
.gitignore 231B
natserver
mvnw.cmd 6KB
pom.xml 3KB
src
test
java
fun
kwok
natserver
NatserverApplicationTests.java 413B
main
resources
application.yaml 517B
java
fun
kwok
natserver
mapper
UserInfoMapper.java 2KB
TubeMapper.java 3KB
NodeLogMapper.java 2KB
WechatUserMapper.java 755B
JobMapper.java 2KB
ResultMapper.java 2KB
SystemUserMapper.java 2KB
TubeUserMapper.java 1006B
SystemV2UserMapper.java 1KB
NatserverApplication.java 853B
controller
OperatorController.java 2KB
SystemV2UserController.java 2KB
NodeControl.java 1KB
AdminController.java 15KB
NodeWebSocketHandler.java 8KB
SearchController.java 933B
AuthController.java 7KB
WechatUserController.java 4KB
utils
CheckCodeUtil.java 3KB
MyPasswordEncoder.java 533B
MD5Util.java 775B
service
NodeLogService.java 3KB
JobService.java 1KB
SystemV2UserService.java 7KB
TubeService.java 2KB
TubeUserService.java 1KB
AuthService.java 521B
ResultService.java 1KB
UserInfoService.java 1KB
SystemUserService.java 2KB
MyCustomUserService.java 2KB
WechatUserService.java 2KB
entity
UserInfo.java 631B
SystemUser.java 901B
WechatUser.java 334B
Job.java 347B
SystemV2UserRecord.java 405B
NodeLog.java 1KB
Result.java 702B
ResultInfo.java 375B
NodeSocketBean.java 150B
SystemV2User.java 345B
Tube.java 515B
TubeUser.java 169B
config
WebSocketConfig.java 883B
WebSecurityConfig.java 5KB
.mvn
wrapper
maven-wrapper.properties 218B
maven-wrapper.jar 50KB
MavenWrapperDownloader.java 5KB
mvnw 10KB
.gitignore 395B
hardwareNode
sketch_mar20a
pcr_test_node
pcr_test_node.ino 6KB
nat.sql 11KB
共 94 条
- 1
资源评论
- 花开太行2024-04-17资源内容详尽,对我有使用价值,谢谢资源主的分享。onnx2024-06-18感谢您对项目的认可和对资源的支持,互相学习进步!
onnx
- 粉丝: 9404
- 资源: 5594
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功