|
|
|
@ -20,6 +20,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
@ -436,6 +437,70 @@ public class FontController {
|
|
|
|
|
return Msg.success().add("token",token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 不需密码
|
|
|
|
|
* @param userName
|
|
|
|
|
* @return
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "getToken1",method = RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Msg getToken1(String userName) throws Exception{
|
|
|
|
|
if(StringUtils.isBlank(userName)){
|
|
|
|
|
return Msg.fail("用户名不能为空");
|
|
|
|
|
}
|
|
|
|
|
List<Power_User> powerUsers = userService.checkUserName(userName);
|
|
|
|
|
if(CollectionUtils.isEmpty(powerUsers)){
|
|
|
|
|
return Msg.fail("用户名不正确");
|
|
|
|
|
}
|
|
|
|
|
String date = String.valueOf(DateUtils.getDate());
|
|
|
|
|
String token = Base64.encode(MD5.KL(date));
|
|
|
|
|
Power_UserVo userVo = new Power_UserVo();
|
|
|
|
|
BeanUtils.copyProperties(powerUsers.get(0),userVo);
|
|
|
|
|
List<Power_Menu> list = null;
|
|
|
|
|
List<User_Dept_Menu> menuList = new ArrayList<>();
|
|
|
|
|
Set<String> menus = new TreeSet<>();
|
|
|
|
|
if (userVo.getRoleId().equals(0) || userVo.getRoleId().equals(-100)) {
|
|
|
|
|
list = powerMenuService.queryAllPowerMenu(null,userVo.getRoleId());
|
|
|
|
|
} else {
|
|
|
|
|
list = powerMenuService.selectUserAndRoleMenuListPower(userVo.getUserId(),null);
|
|
|
|
|
}
|
|
|
|
|
if(null != list && !list.isEmpty()){
|
|
|
|
|
for (Power_Menu powerMenu : list) {
|
|
|
|
|
User_Dept_Menu deptMenu = new User_Dept_Menu();
|
|
|
|
|
String menuUrl = powerMenu.getMenuUrl();
|
|
|
|
|
if (StringUtils.isNotBlank(menuUrl)) {
|
|
|
|
|
BeanUtils.copyProperties(powerMenu, deptMenu);
|
|
|
|
|
deptMenu.setMethodParent(powerMenu.getParentId());
|
|
|
|
|
menuList.add(deptMenu);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(powerMenu.getMethod())) {
|
|
|
|
|
menus.add(powerMenu.getMenuUrl());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
userVo.setMenuList(menuList);
|
|
|
|
|
userVo.setMenus(menus);
|
|
|
|
|
|
|
|
|
|
//设置科室
|
|
|
|
|
StringBuilder powerDepts = new StringBuilder();
|
|
|
|
|
if(StringUtils.isNotBlank(userVo.getDeptId())) {
|
|
|
|
|
List<Power_Dept> powerDeptList = power_deptService.selectByPrimaryKeys(userVo.getDeptId());
|
|
|
|
|
for (int j = 0; j < powerDeptList.size(); j++) {
|
|
|
|
|
if (j < powerDeptList.size() - 1) {
|
|
|
|
|
powerDepts.append(powerDeptList.get(j).getDeptName()).append(",");
|
|
|
|
|
} else {
|
|
|
|
|
powerDepts.append(powerDeptList.get(j).getDeptName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
userVo.setRemark(powerDepts.toString());
|
|
|
|
|
}
|
|
|
|
|
//移除缓存
|
|
|
|
|
CacheManager.removeCacheByObject(userVo);
|
|
|
|
|
CacheManager.putCache(date,new Cache(date,userVo,TOKEN_EXPIRE_TIME));
|
|
|
|
|
return Msg.success().add("token",token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 2.11
|
|
|
|
|
* @MethodName getUnReadCount
|
|
|
|
|