/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.controller;
import cn.stylefeng.guns.config.properties.GunsProperties;
import cn.stylefeng.guns.core.common.annotion.BussinessLog;
import cn.stylefeng.guns.core.common.annotion.Permission;
import cn.stylefeng.guns.core.common.constant.Const;
import cn.stylefeng.guns.core.common.constant.dictmap.UserDict;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.common.constant.state.ManagerStatus;
import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.modular.system.factory.UserFactory;
import cn.stylefeng.guns.modular.system.model.User;
import cn.stylefeng.guns.modular.system.service.IUserService;
import cn.stylefeng.guns.modular.system.transfer.UserDto;
import cn.stylefeng.guns.modular.system.warpper.UserWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.datascope.DataScope;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.core.util.ToolUtil;
import cn.stylefeng.roses.kernel.model.exception.ServiceException;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.naming.NoPermissionException;
import javax.validation.Valid;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* 系统管理员控制器
*
* @author fengshuonan
* @Date 2017年1月11日 下午1:08:17
*/
@Controller
@RequestMapping("/mgr")
public class UserMgrController extends BaseController {
private static String PREFIX = "/system/user/";
@Autowired
private GunsProperties gunsProperties;
@Autowired
private IUserService userService;
/**
* 跳转到查看管理员列表的页面
*/
@RequestMapping("")
public String index() {
return PREFIX + "user.html";
}
/**
* 跳转到查看管理员列表的页面
*/
@RequestMapping("/user_add")
public String addView() {
return PREFIX + "user_add.html";
}
/**
* 跳转到角色分配页面
*/
//@RequiresPermissions("/mgr/role_assign") //利用shiro自带的权限检查
@Permission
@RequestMapping("/role_assign/{userId}")
public String roleAssign(@PathVariable Integer userId, Model model) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
User user = this.userService.selectOne(new EntityWrapper<User>().eq("id", userId));
model.addAttribute("userId", userId);
model.addAttribute("userAccount", user.getAccount());
return PREFIX + "user_roleassign.html";
}
/**
* 跳转到编辑管理员页面
*/
@Permission
@RequestMapping("/user_edit/{userId}")
public String userEdit(@PathVariable Integer userId, Model model) {
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
assertAuth(userId);
User user = this.userService.selectById(userId);
model.addAttribute(user);
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
LogObjectHolder.me().set(user);
return PREFIX + "user_edit.html";
}
/**
* 跳转到查看用户详情页面
*/
@RequestMapping("/user_info")
public String userInfo(Model model) {
Integer userId = ShiroKit.getUser().getId();
if (ToolUtil.isEmpty(userId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
User user = this.userService.selectById(userId);
model.addAttribute(user);
model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid()));
model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid()));
LogObjectHolder.me().set(user);
return PREFIX + "user_view.html";
}
/**
* 跳转到修改密码界面
*/
@RequestMapping("/user_chpwd")
public String chPwd() {
return PREFIX + "user_chpwd.html";
}
/**
* 修改当前用户的密码
*/
@RequestMapping("/changePwd")
@ResponseBody
public Object changePwd(@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) {
if (!newPwd.equals(rePwd)) {
throw new ServiceException(BizExceptionEnum.TWO_PWD_NOT_MATCH);
}
Integer userId = ShiroKit.getUser().getId();
User user = userService.selectById(userId);
String oldMd5 = ShiroKit.md5(oldPwd, user.getSalt());
if (user.getPassword().equals(oldMd5)) {
String newMd5 = ShiroKit.md5(newPwd, user.getSalt());
user.setPassword(newMd5);
user.updateById();
return SUCCESS_TIP;
} else {
throw new ServiceException(BizExceptionEnum.OLD_PWD_NOT_RIGHT);
}
}
/**
* 查询管理员列表
*/
@RequestMapping("/list")
@Permission
@ResponseBody
public Object list(@RequestParam(required = false) String name, @RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) Integer deptid) {
if (ShiroKit.isAdmin()) {
List<Map<String, Object>> users = userService.selectUsers(null, name, beginTime, endTime, deptid);
return new UserWarpper(users).wrap();
} else {
DataScope dataScope = new DataScope(ShiroKit.getDeptDataScope());
List<Map<String, Object>> users = userService.selectUsers(dataScope, name, beginTime, endTime, deptid);
return new UserWarpper(users).wrap();
}
}
/**
* 添加管理员
*/
@RequestMapping("/add")
@BussinessLog(value = "添加管理员", key = "account", dict = UserDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData add(@Valid UserDto user, BindingResult result) {
if (result.hasErrors()) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
// 判断账号是否重复
User theUser = userService.getByAccount(user.getAccount());
if (theUser != null) {
throw new ServiceException(BizExceptionEnum.USER_ALREADY_REG);
}
// 完善账号信息
user.setSalt(ShiroKit.getRandomSalt(5));
user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt()));
user.setStatus(ManagerStatus.OK.getCode());
user.setCreatetime(new Date());
this.userService.insert(UserFactory.createUser(user));
return SUCCESS_TIP;
}
/**
* 修改管理员
*
* @throws NoPe
没有合适的资源?快使用搜索试试~ 我知道了~
JAVA基于SSM的社区诊疗管理系统代码
共429个文件
java:178个
js:84个
html:58个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 118 浏览量
2023-04-20
12:02:49
上传
评论
收藏 2.1MB ZIP 举报
温馨提示
JAVA基于SSM的社区诊疗管理系统,主要包含六个大模块:系统管理、病例信息、药物信息管理、居民健康信息、居民就诊信息和我的预约信息。项目启动后可以通过管理员身份、医生或者病人身份进入系统,进入系统后会呈现对应的后台管理主界面,通过后左侧的导航菜单,实现不同模块功能的使用、数据维护等。 运行环境 jdk8+tomcat9+mysql5.7+IntelliJ IDEA+maven 项目技术 开发工具:idea navicat 后台数据库:MySQL 前端技术:HTML、CSS、javaScript、jQuery、Ajax、JSON 后台技术:mybatis、spring、springboot、 Shiro、Swagger 工具:Maven、Git、IDEA、Navicat 服务器:tomcat9 maven管理
资源推荐
资源详情
资源评论
收起资源包目录
JAVA基于SSM的社区诊疗管理系统代码 (429个子文件)
style.css 133KB
bootstrap.min.css 118KB
font-awesome.css 32KB
bootstrap-rtl.css 31KB
font-awesome.min.css 26KB
layer.css 14KB
chosen.css 12KB
laydate.css 8KB
zTreeStyle.css 6KB
bootstrap-table.min.css 6KB
layer.css 5KB
demo.css 2KB
login.css 2KB
custom.css 1KB
_fstyle.css 975B
bootstrap-treetable.css 923B
bootstrapValidator.min.css 694B
webuploader.css 554B
webuploader.css 515B
fontawesome-webfont.eot 67KB
glyphicons-halflings-regular.eot 20KB
iconfont.eot 2KB
boy.gif 13KB
girl.gif 9KB
loading-0.gif 6KB
zTreeStandard.gif 5KB
loading-2.gif 2KB
loading-upload.gif 2KB
loading-1.gif 701B
loading.gif 381B
line_conn.gif 45B
code.html 6KB
dict_edit.html 4KB
user_view.html 4KB
_container.html 4KB
_tab.html 4KB
user.html 3KB
dict_add.html 3KB
login.html 3KB
_right.html 3KB
_theme.html 3KB
code.html 2KB
user_roleassign.html 2KB
role_assign.html 2KB
log.html 2KB
menu_edit.html 2KB
user_edit.html 2KB
user_add.html 2KB
role.html 2KB
role_edit.html 2KB
dept_edit.html 2KB
patientHistory.html 2KB
menu.html 2KB
patientHealth.html 2KB
patientHealth.html 2KB
medicineInfo.html 2KB
doctorPoint.html 2KB
patientInfo.html 2KB
patientHistory_edit.html 2KB
order.html 2KB
role_add.html 2KB
notice.html 2KB
dept_add.html 2KB
info.html 2KB
dept.html 2KB
dict.html 2KB
index.html 2KB
patientHealth_edit.html 2KB
notice_edit.html 2KB
login_log.html 2KB
patientHealth_edit.html 2KB
user_chpwd.html 2KB
patientHistory_add.html 2KB
notice_add.html 2KB
patientHealth_add.html 1KB
doctorPoint_edit.html 1KB
menu_add.html 1KB
patientHealth_add.html 1KB
doctorPoint_add.html 1KB
order_edit.html 1KB
medicineInfo_edit.html 1KB
404.html 1KB
order_add.html 1KB
info_edit.html 1KB
medicineInfo_add.html 1KB
patientInfo_edit.html 1KB
info_add.html 1KB
patientInfo_add.html 1KB
blackboard.html 389B
favicon.ico 4KB
UserMgrController.java 14KB
ConstantFactory.java 10KB
Contrast.java 9KB
DictSelectorTag.java 9KB
MenuController.java 8KB
ShiroConfig.java 8KB
ShiroKit.java 8KB
RoleController.java 8KB
WebConfig.java 7KB
MenuNode.java 6KB
共 429 条
- 1
- 2
- 3
- 4
- 5
资源评论
办公模板库素材蛙
- 粉丝: 1548
- 资源: 2289
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功